jQuery UI Widgets › Forums › TreeGrid › CRUD – Callback not triggered
This topic contains 6 replies, has 3 voices, and was last updated by Martin 6 years, 5 months ago.
-
Author
-
Maybe someone has a working example for jqxTreeGrid and CRUD?
My code isn’t working, I don’t know why it isn’t triggered :-/var source = { [...] deleteRow: function (rowid, commit) { alert(rowid); // synchronize with the server - send delete command [..] } };
Triggering, like in jqxGrid, with:
grid.jqxTreeGrid("deleteRow", 1);
But the callback never run…
Hello TDS,
Here is a working Example on how the deleteRow callback function is called.
It seems that the issue is coming from somewhere else in your code.Best Regards,
MartinjQWidgets Team
http://www.jqwidgets.com/Please take a look and read the title. The example you mentioned didn’t use callbacks in source adapter. I compared Grid and TreeGrid. In Grid it is working with nearly same code.
Hello TDS,
From your question I understand that this callback was not executed:
deleteRow: function(rowid, commit){ alert(rowid); // synchronize with the server - send delete command // call commit with parameter true if the synchronization with the server is successful // and with parameter false if the synchronization failed. commit(true); }
This is where you should send your delete request to the server.
If this doesn’t help you, please provide more of your code so we can take a look.
Best Regards,
MartinjQWidgets Team
http://www.jqwidgets.com/I will go deeper:
– jQWidgets v5.6.0 (2018-Feb)
– first there is a jqxWindow to ask if deletion is okay, then calling deleteRow (like API say)$confirm.on("close", function(event) { if (event.args.dialogResult.OK) { grid.jqxTreeGrid("deleteRow", currentID); } });
– callback deleteRow in source adapter should be triggered – but it isn’t
deleteRow: function (rowid, commit) { console.log("deleteRow"); // will never reach here })
In Grid the callback is defined as “deleterow” in TreeGrid as “deleteRow” (capitalized R)
Grid (working):
deleterow – callback function, called when a row is deleted. If multiple rows are deleted, the rowid parameter is an array of row ids.
deleterow: function (rowid, commit) {
// synchronize with the server – send delete command
// call commit with parameter true if the synchronization with the server is successful
//and with parameter false if the synchronization failed.
commit(true);
}TreeGrid (not working):
https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxtreegrid/jquery-treegrid-data-editing.htmThe deleteRow method can be used for deleting a row from the TreeGrid.
$(“#treeGrid”).jqxTreeGrid(‘deleteRow’, rowKey);
When you call addRow, deleteRow or updateRow methods, the TreeGrid source object’s addRow, deleteRow or updateRow would be called as well.So a working example for jqxTreeGrid with source adapter callbacks (and e.g. manually triggering like in jqxGrid) would be helpful (not only inline editing, etc.). Maybe there is a bug?
Hello TDS,
You may take a look at this sample: https://www.jqwidgets.com/jquery-widgets-demo/demos/jqxtreegrid/javascript-tree-grid-inline-editing.htm?light. Calling the UI’s CRUD methods, calls the data source API methods.
Best Regards,
PeterjQWidgets Team
http://www.jqwidgets.com/Hello TDS,
The example that I have sent you is triggering the deleteRow callback function in the source adapter when you call “$(“#treeGrid”).jqxTreeGrid(‘deleteRow’, 4);” :
deleteRow: function(rowid, commit){ alert(rowid); // synchronize with the server - send delete command // call commit with parameter true if the synchronization with the server is successful // and with parameter false if the synchronization failed. commit(true); }
I have now updated the example, also with a confirmation jqxWindow: Fiddle
Best Regards,
MartinjQWidgets Team
http://www.jqwidgets.com/ -
AuthorPosts
You must be logged in to reply to this topic.