Hello,
I need help with a jquery function...
I have table (view png for example) and there are rows and related rows that relate to an original row, so row 1 with data and row 1a, with status of of void. There is also a checkbox above the table that when clicked will hide the row and related row that have action of void. So essentially hide any row that has action status of void and the related row or corresponding row. The related row should normally be above the voided row, but may not always be right on top of each other, as sorting will be ascending related rows will always be above rows with void status.
I am new to javascript and jquery, so any code or examples you can provide, would be much appreciated. If I could double the points awarded I would...
here is something that a friend gave me that might help get started.
When the "Hide voided items" box is checked, we not only hide the rows that contain Action = Void, but also the related row that was voided. In the example below, each yellow voided row is related to red row directly above it.
NOTE: Related rows will not always be located DIRECTLY above the Void row, but they will ALWAYS be ABOVE the Void row because the table is always sorted by Date ascending. Void can only be related to something that's already occurred.
You need to write a script using JQuery where its useful to streamline code, and/or with standard Javscript. What's important is to make the script with a few as lines as possible. Unless you can come up with a better alternative, and I encourage you to consider all possibilities, I think your script should be based on the following logic:
hideVoid(){
get the Activity Log table
go to last row and begin traversing the rows in reverse order
looking for a row where column #2 innerHTML = "Void"
if true, remember the row num
continue traversing up the table looking for the row that relates to our Void row
if the next row is not a Void row, see if it's a related row
to match a related row, see if column 1, column 3, column 4, AND column 5 innerHTML = same innerHTML from our Void row (all must match)
hide the related row and the Void row
continue traversing up the table looking for any more Void rows
if we find another Void, repeat the process to find related row
]
Thank you, much appreciated for your help!!