This is a migrated thread and some comments may be shown as answers.

OnDataBound fires too early

0 Answers 112 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Nadisan
Top achievements
Rank 2
Nadisan asked on 01 Jun 2012, 09:14 AM
Hello,

My issue sounds like this:

I am trying to persist the selected rows of a grid throw paging.

I have the following SourceCode:

dataBinding: function() {
                    //store the uids of selected rows
                    $("#requestGrid .k-state-selected").each(function() {
                        uids.push($(this).data("uid"));
                    });
                },
                dataBound: function() {
//                    selects first grid item
//                    this.select(this.tbody.find(">tr:first"));
                    resizeGrid();
 
                    if (uids.length != 0) {
                        for (var i = 0; i < uids.length; i++) {
                            var currUid = uids[i];
                            //find and reselect the rows via their uid attribute
                            this.tbody.find("tr[data-uid='" + currUid + "']").addClass("k-state-selected");
                        }
                    }
                },

So..., onDataBinding, I save the selected rows, and, onDataBound, I select the previeous selected rows.

The problem is that when the onDataBound event fires, the page of the grid which contains these Id's is not loaded..., so, the class "k-state-selected" won't be added.

Please help.

Later edit

Hmmmm, it seems that the Uid of the grid is not static..., it changes on each databound or databinding...

No answers yet. Maybe you can help?

Tags
Grid
Asked by
Nadisan
Top achievements
Rank 2
Share this question
or