Set the Index column of the grid / table – jQuery

Standard

During development one often come across this issue specially if you are using custom client side grids, that after deleting row in grid, the index of whole grid is disturbed and results in random/missing index values. Well the simple way to resolve this issue is to iterate whole grid and re-index the rows.

$("#tableID tr").each(function (i) {
            $(this).children("td:first").text(i);
        });

P.S. Just mention grid id in selector list and everything is handled by these two lines of codes.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s