Can you provide a javascript example for refreshing/reloading the grid client-side?
I want to migrate the following UltraWebGrid js code: grid.invokeXmlHttpRequest(grid.eReqType.Refresh);
The _rc attribute is the total record count.
The Page_Load code snippet seems to be copied wrong. Corrected version.
protected void Page_Load(object sender, EventArgs e){ grid.GridResponse.AdditionalProperties.Add("_rc", RecordCount);}
JS function j_dataGridRefresh forces the VirtualScrolling behavior to run. JS function j_dataGridAJAXResponse is the client side event handler and registered like this:
grid.ClientEvents.AJAXResponse =
"j_dataGridAJAXResponse";
The purpose of j_dataGridAJAXResponse is to force the grid to do some postprocessing, because I had layout problems.
Perhap it is best if you try to use j_dataGridRefresh and only use the page_load code and the j_dataGridAJAXResponse if you get unexpected results.
I don't fully understand how this code is wired up. How are the functions called? Also, the Page_Load example code snippeet is confusing to me.
Please advise.
That's just the trick I've been hoping to find, thanks!
I understand what the j_dataGridRefresh is doing, but what's the AJAXResponse and the _rc attribute there for?
Jeff,
The UpdatePanel did not show the WebDataGrid in IE8 and Chroome, because its height was not set correctly. I added the following CSS rule to my stylesheet. (igspl_Pane is the CSS class of the websplitter).
.igspl_Pane > DIV { height : 100%;}
However I do not use the UpdataPanel. I already used the VirtualScrollingBehavior. I have created a client-side refresh javascript function (j_dataGridRefresh) and I use the clientside event AJAXResponse (j_dataGridAJAXResponse).
c#:
protected void Page_Load(object sender, EventArgs e){ grid.GridResponse.AdditionalProperties.Add(
"_rc", RecordCount);}
function
j_dataGridAJAXResponse(sender, args) { if (args.get_gridResponseObject !== undefined) { var responseObject = args.get_gridResponseObject();
if (responseObject) { var rc = responseObject.AdditionalProperties["_rc"];
if (rc || rc === 0) { var behaviors = sender.get_behaviors(); var virtualScrolling = behaviors.getBehaviorByName("VirtualScrolling"); virtualScrolling._recordCount = rc; virtualScrolling._onInitVerticalHeight(virtualScrolling._vsb()); } } }}
Did you ever find a solution to this?
I am running into the same issue.
I need to to a client side ajax refresh of a WebDataGrid.
Thanks,Jeff