Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1085
Bulk update question
posted

We have numerous scenarios where we need to perform bulk updates of the grid in response to user requests.

These bulk updates fall into two general categories:

1) Setting specific properties in the data (usually bit flags)

2) Adding a number of rows to the grid (usually a large number)

For scenario 1, we have tried using setCellValue, but even updating 100 rows takes 15 seconds using code similar to the following:

            var cGridRows = oGridJQ.igGrid("allRows");

            var sRowId;

            $.each(cGridRows, function (wIndex, oGridRow) {
                if ((oGridRow.style.visibility == "hidden") || (oGridRow.style.display == "none")) {
                    // Don't process hidden rows
                } else {
                    sRowId = oGridRow.attributes("data-id").value;
                    // If IsSelected is not the same as the requested value
                    if (oGridJQ.igGrid("getCellValue", sRowId, "IsSelected") != fValue) {
                        // Update the row with the requested value
                        oGrid.Grid.igGridUpdating("setCellValue", sRowId, "IsSelected", fValue);
                    }
                }
            });

Every time I break in javascript debugger while this is happening, it is in _renderData.

What we would like to do is update the data source directly, then refresh the grid.

I know how to update the data source directly, but that doesn't update the grid. And if I call bindData, it uses the original data, not the updated data since the direct datasource updates are not transacted (we use autoCommit).

Here is code similar to what we use for this second approach:

            var cGridRows = oGridJQ.igGrid("allRows");
            var oDataSource = oGridJQ..igGrid("option", "dataSource").data();
            var oDataRow;
            var fAnyUpdated = false;

            $.each(cGridRows, function (wIndex, oGridRow) {
                if ((oGridRow.style.visibility == "hidden") || (oGridRow.style.display == "none")) {
                    // Don't process hidden rows
                } else {
                    oDataRow = oDataSource[wIndex];

                    // If IsSelected is not the same as the requested value
                    if (oDataRow.IsSelected != fValue) {
                        fAnyUpdated = true;
                        // Update the row with the requested value
                        oDataRow.IsSelected = fValue;
                    }
                }
            });
            if (fAnyUpdated) {
                oGridJQ.igGrid("dataBind");
            }


Performance is critical to our end users and they work with somewhat large datasets on a regular basis, (1000-3000 records).

We switched from UltraWebGrid to igGrid specifically due to performance issues, but now this issue is threatening to derail the entire project.

Can we please get some assistance with this?

Parents Reply Children