Hi there,
I have a grid that is backed by a dhtmlxconnector. When someone edits a cell, I want to update all cells that match some criteria to match. I have written the code in the beforeUpdate event on the server side connector, and I just want to refresh the grid to read the new values (but I want it to remember the filtering, sorting etc).
In a simplified example below (there are lots more columns), if I change the driver for one journey, then I want it to be updated for all journeys for that duty. So - if I change the driver for journey 1 to be “Mr C”, then I want journey’s 2 and 3 to also be updated to have the driver “Mr C”.
journey duty driver
1 d1 Mr A
2 d1 Mr A
3 d1 Mr A
4 d2 Mr B
5 d2 Mr B
6 d2 Mr B
The code on the server is fairly straightforward - update the table setting driver to the value for the driver field on the updated row, where the duty id is the same. Having done that, I want to refresh the dhtmlxgrid on the client side to reflect this change. I thought something like the following should work, but it doesn’t.
dp.attachEvent("onAfterUpdateFinish", function() {
alert("Database is updated correctly, but need to make a call here that will reload the grid, preserving the current filters+sorting.");
mygrid.refreshFilters();
mygrid.clearAndLoad("connector.php");
return true;
});
A workaround that I can think of is to implement the same changes to the front end in javascript, but this feels like a dirty hack, and it seems to be that there should be a simple function “reloadGrid()” that reloads the data from the connector, preserving the current filtering and sorting.
Does anyone have any ideas?
Thanks!