comparison - JQuery Compare Table Data -
i have large table of data (that displays test data) separated date. sort data post-processing using jquery (the table built in perl , sorting can't done there). after data sorted date, add separating line between each day.
for instance, i'd 5 test runs june 5th, followed blank line (a blank "tr", have data added later that's not important here), followed june 4th runs, blank line, june 3rd runs, etc.
here sample of table have: http://jsfiddle.net/pyuz8/1/
here pseudocode have, not sure how in jquery:
now = thisdate.substring(0,10) //look @ date, time doesn't matter = previousdate.substring(0,10)
if (then != now) insert(
"<tr></tr>"); //inbetween , now
how can done in jquery?
run through each row, compare current date next date, insert tr after current row if dates differ. this:
$('tr').each(function(){ var current_date = $(this).children('.date_cell').val() // or whatever call date cell var next_date = $(this).next().children('.date_cell').val() // strip these evaluations time described... if (current_date != next_date){ $(this).after('<tr class="blank_row"></tr>) } })
Comments
Post a Comment