Speed up UltraWebGrid rendering on rebind

If you’re using Infragistics UltraWebGrid with it’s property Browser="Xml", you may find yourself living in a shotgun shack in a strange situation: When grid is rebinding – it takes (comparatively) short time to do server-side processing and then a very long time to render grid in the browser.

In my case it was most felt when grid (which had ViewType="OutlookGroupBy") was initially grouped with a lot of data in each group and then ungrouped back into flat view when user dragged last group column out. Using IE9 built-in developer tools I ran JavaScript profiler I found that culprit was Infragistics JS function “disposeNode” which was called numerous times and had worst both inclusive and exclusive execution time.

Apparently what was happening – before bringing in fresh data grid was destroying all XML nodes of existing data, which – when grid is grouped with a lot of data in each group – is a lot of nodes. I decided to test what would happen if I destroy all top-level nodes in advance, so grid’s code won’t have to recursively loop through each one of them. I did this with just these 2 lines of JavaScript code:

var oGrid = igtbl_getGridById('xMyGrid');
if (oGrid) oGrid.Rows.SelectedNodes.removeAll();

Basically here we get a reference to grid’s client-side object and clear all nodes associated with grid’s rows. My grid didn’t use it’s own AJAX “LoadOnDemand” features and was located inside of Infragistics WARP panel, so I put that code inside of WARP panel’s RefreshRequest event handler which is called before grid’s server-side rebind. Your setup may be different, but you just have to run these lines before grid gets new data.

Result: Rendering in the client almost 90% faster.

Leave a Reply

Your email address will not be published. Required fields are marked *