I have a RadGrid that I want to bind totally on the client side. I used a RadClientDataSource and it populates nicely. I have many records, so I want to use custom paging and sorting so I am only pulling 5 records at a time. When I click on a row, I have it use an ajax call from jquery to get the VirtualItemCount and use set_virtualItemCount() to set property on RadGrid.
This all seems to work okay. But when I click on a sort column or a pager item, it blanks the whole grid. What events handler can I implement on client side to handle the sort event and the PageIndexChanged event? Here is my how I am handling the row clicked event:
function rowClick(sender, eventArgs) {
var nodeid = eventArgs._dataKeyValues["NodeId"];
var masterTable = sender.get_masterTableView();
var url = "/myservice.asmx/GetRowCount";
var params = JSON.stringify({ NodeId: nodeid });
$.ajax({
method: "POST",
url: url,
data: params,
dataType: "json",
contentType: "application/json; charset=utf-8",
})
.done(function (msg) {
masterTable.set_virtualItemCount(msg.d);
window.nodeId=nodeid;
masterTable.rebind();
});
}
function ParameterMap(sender, args) {
if (args.get_type() == "read" && args.get_data()) {
var skip = window.pageSize * window.pageIndex;
var take = window.pageSize;
var params = { NodeId: window.nodeId, Skip: skip, Take: take, SortExpression: window.sort};
var paramstr = JSON.stringify(params);
args.set_parameterFormat(paramstr);
}
}
Hi Mike,
Can you please share the rest of the implementation (RadGrid, RadClientDataSource in case this is used for binding data through WebService) so we have an idea of how everything is done?
I look forward to hearing from you.