I have a problem reloading ajax data in bootgrid ( http://www.jquery-bootgrid.com/ )
I have successfully prepared the grid for display at all, but if I add an element to db, I want to reload the grid.
my code is now this (abbreviated):
var grid; $(document).ready(function() { grid = initGrid(); }); function initGrid() { var local_grid = $('#clients-grid').bootgrid({ "ajax": true, "url": "/client/grid", "formatters": { "commands": function(column, row) { return "<button type=\"button\" class=\"btn btn-default command-edit\" data-row-id=\"" + row.id + "\"><span class=\"glyphicon glyphicon-pencil\"></span></button> " + "<button type=\"button\" class=\"btn btn-default command-delete\" data-row-id=\"" + row.id + "\"><span class=\"glyphicon glyphicon-trash\"></span></button> " + "<button type=\"button\" class=\"btn btn-default command-mail\" data-row-id=\"" + row.id + "\"><span class=\"glyphicon glyphicon-envelope\"></span></button>"; }, "tooltips": function(column,row) { return '<span type="button" class="content-popover" title="'+row.name+'" data-content="'+row.content+'">Najeฤte myลกรญ pro zobrazenรญ obsahu</span>'; }, "clientname": function(column,row) { return row.name; } } }).on("loaded.rs.jquery.bootgrid", function() { $('.content-popover').popover({ trigger: 'hover', html: true, placement: 'right', content: $(this).attr('data-content') }); grid.find(".command-edit").on("click", function(e) { editClient($(this).data('row-id')); }).end().find(".command-delete").on("click", function(e) { var id = $(this).data('row-id'); if (confirm('Opravdu smazat klienta s ID: '+$(this).data("row-id")+'?')) { deleteClient($(this).data('row-id')); } }).end().find(".command-mail").on("click", function(e){ mailClient($(this).data('row-id')); }); }); return local_grid; }
so the grid variable is global and accessible everywhere. but the reload function is documented here: http://www.jquery-bootgrid.com/Documentation#methods does not work, and I have the ajax parameter set to true
Any tips?
Thanks and sorry for my english
source share