Click here to Skip to main content
15,893,508 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I have used jqgrid to show a report which is generated dynamically. In the first column I get repeated values. I need to remove all the repeated values and their cells except second row first column, then I need it to span across n number of rows using "row span".

How can I do it, any other technique is welcome.

I wanted to post images here but don't know how. Please help.
Posted
Updated 5-Oct-15 23:45pm
v4

1 solution

Hi,
I got the following solution. I wrote this function for my problem. In order for this to work I have to retain the value of the grid and kept refreshing it with the data whenever I had a change in UI. It works very well. For any details please comment.

JavaScript
function groupData() {
                var table = document.getElementById("list_frozen");
                var spansize = table.rows.length - 2;
                for (var i = 2, row; row = table.rows[i]; i++) {
                    if (i < table.rows.length - 1) {
                        for (var j = 0, col; col = row.cells[j] && j < 1; j++) {
             //iterate through columns
             //columns would be accessed using the "col" variable 
             //assigned in the for loop
                            row.deleteCell(j);
                        }
                    }
                }
   $("#list_frozen tbody tr:nth-child(2) > td:nth-child(1)").attr('rowspan', spansize);
}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900