I have a html table with duplicate data in the column as shown below
I want to dynamically merge the html table row cell if the data is same like below table
I am able to do this with giving the value number of cells to span but how can I do this dynamically
Wow, thanks for the interesting task. I came up with this solution http://jsfiddle.net/PhWGF/4/. Not the cleanest code but I will leave this part for you.
You can think about your table as a regular 2d array
so it all comes down to the classical nested loops. We search for a duplicate for each cell in each row of the same column, store first and last occurrence to determine the length of span later.
Note, you need to set all "roswpan" before deleting duplicates.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With