Hi,
I want to do something like your “Todo List” but when I sumit the form I would like to refresh the grid with the query with different parameters (I just want to add some condition in the where clause of the query).
Actually, I make an ajax call who send the parameters to recreate entire grid like this :
$.get('llop.php', {datestart: datestart, dateend:dateend, filter1: $('#filter1').val()}, function(result) {
$(‘#divgrid’).html(result
.html);
}, ‘json’);
That’s not really optimised.
I would like to just rebuild the query and refresh grid with new data. There is a possibility ?
Thanks
Hello,
This is not the exact demo but it shows how to pass additional param to grid when calling reloadGrid function.
It will just reload the data with passing the param ‘query’ to server and it selects different query based on it’s value.
Keep in mind that if you add new columns to the query, the structure will not change as you are only reloading the data. If you wish to change the columns as well, you will need to regenerate whole grid and it can also be done using ajax call.
Code: https://gist.github.com/gridphp/94590490697b97d7f1f239c89bf8c60d
PS: Code is attached now.