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

data binding client and selected row

1 Answer 47 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Luigi Palumbo
Top achievements
Rank 1
Luigi Palumbo asked on 12 Apr 2010, 05:56 PM

Hi,
I have a RADGRID with a DATABIND client-side.
The databind event is raised with a JS SETTIMEOUT function:
setTimeout('bindGrid()', 5000);

and in a bindGrid I have a regular call to my web service:
WS.GetDocumentsSelected(startIndex, pageSize, sortField, sortOrder, filtroT, filtroM, mozione, updateGrid, koMessage);

where filtroT, filtroM, mozione are a custom filter.
The return of WS is a below code

function updateGrid(result) {   
        var tableView = $find("<%=RadGrid1.ClientID %>").get_masterTableView();   
        tableView.set_dataSource(result);   
        tableView.dataBind();   
}  

It's work fine, but I have a problem with selected row:

If I selected the second row, e.g., and I execute a sort command, my row selected persist in the second row.
The same problem occours with paging-change and a filter changed.

I try to save my selected-row id in hidden-field and in data bound function set the selection manually with the follow code:

function RadGrid1_RowDataBound(sender, args) {  
        var dkvs = document.getElementById("<%=DataKeyValueSelected.ClientID%>");   
        if (dkvs && dkvs.value && (args.get_dataItem()["Id_doc"] == dkvs.value)) {   
           //args.get_dataItem().set_selected(true);   
           sender.get_masterTableView().get_dataItems()[parseInt(args.get_item()._itemIndexHierarchical)].set_selected(true);   
        } else {   
           //args.get_dataItem().set_selected(false);   
           sender.get_masterTableView().get_dataItems()[parseInt(args.get_item()._itemIndexHierarchical)].set_selected(false);   
        }  

 

after data bound the paging-change and a sort works fine, but if after row selected I remove my filter, I have all alternating item selected (after the selected row - see attached) .....

1 Answer, 1 is accepted

Sort by
0
Maria Ilieva
Telerik team
answered on 15 Apr 2010, 11:51 AM
Hello Luigi,

Thank you for contacting and for your questions.

I suggest that the problem you are facing could be because of the way you are persisting the selected rows. Please refer to the following help topic which elaborates on this matter.

Let us know if this helps.

Best wishes,
Maria Ilieva
the Telerik team


Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
Grid
Asked by
Luigi Palumbo
Top achievements
Rank 1
Answers by
Maria Ilieva
Telerik team
Share this question
or