Jquery-bootgrid how to use boot event?

I am trying to use bootgrid plugin events (1.2.0).
I read the documentation and I thought I figured out how to do this.

var grid = $("#grid").bootgrid({
    ajax: true,
    url: "grid.php",
    caseSensitive   : false,
    rowCount        : [25, 50, -1],
    columnSelection : false
}).on("load.rs.jquery.bootgrid", function() {
    alert('before load data');
}).on("loaded.rs.jquery.bootgrid", function() {
    alert('after load data');
});

      

Unfortunately, only the loaded event seems to work, in fact, the "before data load" warning does not appear.
What is the correct way to do this?

thank

+3


source to share


1 answer


You need to bind the load event before initializing the Bootgrid itself.



$(function(){
    $("#grid").on("load.rs.jquery.bootgrid", function() {
        alert('before load data');
    }).bootgrid({
        ajax: true,
        url: "grid.php",
        caseSensitive   : false,
        rowCount        : [25, 50, -1],
        columnSelection : false
    }).on("loaded.rs.jquery.bootgrid", function() {
        alert('after load data');
    });
});

      

+2


source







All Articles