How to show wait cursor over grid manually

1 Answer 54 Views
Grid Toolbar
Bill
Top achievements
Rank 1
Bill asked on 25 Aug 2023, 03:36 PM

 

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

1 Answer, 1 is accepted

Sort by
0
Martin
Telerik team
answered on 30 Aug 2023, 08:53 AM

Hello, Bill.

Thank you for the provided code snippets.

I assembled a small Dojo example similar to what you shared. If you put a debugger in the zeroOOS function, you can see that the loading icon appears before the loop starts.

Could you please let me know if I am missing something from the issue?

Looking forward to your reply.

Regards,
Martin
Progress Telerik

Stay tuned by visiting our public roadmap and feedback portal pages! Or perhaps, if you are new to our Kendo family, check out our getting started resources
Tags
Grid Toolbar
Asked by
Bill
Top achievements
Rank 1
Answers by
Martin
Telerik team
Share this question
or