update sql_command with ajax

Questionsupdate sql_command with ajax
djyo asked 1 year ago

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

1 Answers
Abu Ghufran Staff answered 1 year ago

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

_________________________
Abu Ghufran - Dev Team
Grid 4 PHP Framework
 
Abu Ghufran Staff replied 1 year ago

PS: Code is attached now.

Your Answer

4 + 6 =

Login with your Social Id:

OR, enter

Attach code here and paste link in question.
Attach screenshot here and paste link in question.



How useful was this discussion?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate it.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?