Hi. I have a page with three grids on it using three different tables. The three tables relate to each other, with the middle table being a joining table.
e.g. Customers, Customers <–> Groups, Groups
Since the tables are interdependent, I need to be able to refresh the other two tables when one table is updated.
How can I generate a custom script which is triggered on update or delete of a record?
I tried:
$e[“js_on_delete_row”] = “do_delete”;
$g3->set_events($e);
But that didn’t seem to work.
Also, is there a quick way to refresh all the tables at once using Jquery?
I am using the premium version if any advanced features are needed.
Thanks in advance.
You can try these:
// for update callback, refreshes list1
$opt["onAfterSave"] = "function(){ jQuery('#list1').trigger('reloadGrid',[{current:true}]); }";
// for delete js callback
$opt["delete_options"]["afterSubmit"] = 'function(response) { if(response.status == 200) { jQuery("#list1").trigger("reloadGrid",[{current:true}]); return [true,""]; } }';
Thank you very much! I got the delete function to work:
$grid[“delete_options”][“afterSubmit”] = ‘function()
{
$(“#refresh_all”).click();
return [true,””];
}’;
I also got the update callback to work, but unfortunately there appears to be a bug.
This code will work:
$grid[“onAfterSave”] = ‘function() { $(“#refresh_all”).click(); }’;
So long as I click a row end then click the ‘Edit’ button, make changes, and save.
However, if I use in-line editing, it appears to interfere with saving the data.
In other words, if I use in-line editing of a row, make changes to a cell, and then click on the save button, the row doesn’t change. Nothing appears to happen, but the Javascript console show this error:
“Uncaught SyntaxError: Unexpected end of input”
Is this an issue you’re aware of? Is there a workaround?
Many thanks in advace.
Update: I tried altering the function which is called when #refresh_all is clicked (a button). This function reloads all the grid on the page, including the one being edited.
I thought the problem was that I was reloading the grid that I was editing, so I removed the reload on that grid.
Unfortunately, I still have the same error.
Hello,
Can you setup a remote session to see the issue.
You can email me at [email protected] and we can solve this case.
I am unable to understand the issue by provided details.