Where should I use the method before loading Jqgrid and after loading the grid to lock the screen?

I wrote functionality in a java script that locks the screen and unlocks the screen. A block screen means that it locks the screen, so the user cannot click anything (a loader icon appears on the screen).

There are two UIBlocker methods.

1. UIBlocker.blockScreen()   // It blocks the screen.
2. UIBlocker.unblockScreen()  // It unblocks the screen.

Now I need to lock the screen when loading JQGrid. I want to ask where should I use UIBlocker.blockScreen () and UIBlocker.unblockScreen () .?

According to my findings, UIBlocker.blockScreen should be used in the beforeRequest event , since it is fired before requesting data. But there are other events that fire before loading, for example beforeProcessing, loadBeforeSend . Therefore, I am still embarrassed.

Secondly, where should I use unblockScreen . In loadComplete or in gridComplete ?

Here I found the execution order of jqgrid,

beforeRequest
loadBeforeSend
serializeGridData
loadError (if a error from the request occur - the event from steps 5 till 7 do not execute. If there is no error the event 4. does not execute and we continue to with the step 5.)
beforeProcessing
gridComplete
loadComplete

Now suggest me where should I use BlockScreen and unblockScreen ?

+4
source share
2 answers

loadui: "block" . . (-).

, , . jqGrid jqGrid, (free jqGrid, Guriddo jqGrid JS jqGrid <= 4.7). , - 4.4.4. , , / :

loadui: "disable",  // remove the standard grid blocking
loadBeforeSend: function () {
    UIBlocker.blockScreen(); // block the grid/screen
    return true;    // allow request to the server
},
beforeProcessing: function () {
    UIBlocker.unblockScreen(); // unblock the grid/screen
    return true;    // process the server response
},
loadError: function (jqXHR, textStatus, errorThrown) {
    UIBlocker.unblockScreen(); // unblock the grid/screen

    // display the eror message in some way
    alert("HTTP status code: " + jqXHR.status + "\n" +
        "textStatus: " + textStatus + "\n" +
        "errorThrown: " + errorThrown);
}

, 4.4.4 -, 3,5 . (4.13.4) jqGrid. jqGrid, Guriddo jqGrid JS (. -). jqGrid , 4.4.4, .

jqGrid, progressBar, jqGrid

$.jgrid.extend({
    progressBar: function (options) {
        if (options.method === "show") {
            //alert("start blocking");
            UIBlocker.blockScreen();
        } else {
            //alert("stop blocking");
            UIBlocker.unblockScreen();
        }
    }
});
+1

jqgrid , :

  • beforeRequest
  • gridComplete
  • loadComplete

Jqgrid

+2

Source: https://habr.com/ru/post/1653635/


All Articles