简体   繁体   中英

jquery-bootgrid how to use load event?

I'm trying to use bootgrid plugin (1.2.0) events.
I read the documentation and I thought I had figured out how to do it

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 alert "before load data" does not appear.
What is the right way to do it?

Thank you

You have to bind load event before initializing 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');
    });
});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM