jQuery UI Widgets Forums TreeGrid CRUD – Callback not triggered

This topic contains 6 replies, has 3 voices, and was last updated by  Martin 5 years, 11 months ago.

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
  • CRUD – Callback not triggered #100824

    TDS
    Participant

    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…

    CRUD – Callback not triggered #100832

    Martin
    Participant

    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,
    Martin

    jQWidgets Team
    http://www.jqwidgets.com/

    CRUD – Callback not triggered #100834

    TDS
    Participant

    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.

    CRUD – Callback not triggered #100857

    Martin
    Participant

    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,
    Martin

    jQWidgets Team
    http://www.jqwidgets.com/

    CRUD – Callback not triggered #100860

    TDS
    Participant

    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.htm

    The 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?

    CRUD – Callback not triggered #100877

    Peter Stoev
    Keymaster

    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,
    Peter

    jQWidgets Team
    http://www.jqwidgets.com/

    • This reply was modified 5 years, 11 months ago by  Peter Stoev.
    CRUD – Callback not triggered #100885

    Martin
    Participant

    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,
    Martin

    jQWidgets Team
    http://www.jqwidgets.com/

Viewing 7 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic.