I have a long running grid altering script that is fired by a custom button placed on the grid tool bar as so:
toolbar: ["save", "cancel", { name: 'STMS', text: "Save To STMS" }, { name: 'RAS', text: "Save To RA" }, { name: 'OOS', text: "Clear OOS" } ],
The button firing function follows:
$(".k-grid-OOS").click(function (e) {
zeroOOS(e);
});
The function follows:
function zeroOOS(e) {
var grid = $('#grid').data("kendoGrid");
var selectedRow = grid.select();
var selectedRowIndex = selectedRow.index();
console.log(selectedRowIndex);
var gridRows = grid.dataSource.data();
kendo.ui.progress($('#grid'), true);
for (var i = 0; i < gridRows.length; i++) {
var thisRow = grid.dataSource.data()[i];
if (thisRow.Material_Name === "OOS") {
thisRow.set("Temp", 0.0);
thisRow.set("Gravity", 0.0);
thisRow.set("Gross_Volume", 0.0);//
thisRow.set("Tank_Level", 0.0);
thisRow.set("Net_Volume", 0.0);
thisRow.set("STMS_Observed_Volume", 0.0);
thisRow.set("STMS_Water_Volume", 0.0);
thisRow.set("Water_Level", 0.0);
}
};
}
The "Waiting" cursor does not appear until AFTER the loop completes even though I requested it before.
I purposely left out turning it off just to see what was going on. The result of the function changes records
in the grid and gives the user the opportunity to either save the changes or cancel and go back to original values.
I tried to "reload" the document just after calling for the cursor change but since the cursor changed after the loop
was completed the reload happened right after the cursor change and removed the changes made by the loop.
I figure this this a function of DOM but am not sure how to get around it. Have seen and tried many javascript
recommendations but nothing so far seems to work.
There was a previous help doc from 2014 (http://dojo.telerik.com/@Kiril/ozuv) that works and does what I want so I tried
those commands in my function but do not get the same results.
Any clues would be much appreciated.
Thank you
Bill Lawler