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) .....