jQuery UI Widgets Forums TreeGrid [bug] row is not deleted after AJAX request

This topic contains 5 replies, has 3 voices, and was last updated by  khawanz 8 months ago.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author

  • ebartashevich
    Participant

    Hi!
    I’ve meet probably a bug: row is not deleted from grid if any AJAX request was sent before.

    Have a row; add a child to this row; then try to delete this row.
    Row is not deleted -> Bug

    if I put grid_container.jqxTreeGrid('deleteRow', nid); before AJAX call – row is deleted.
    Ajax call is done without errors.

    I use following code:

    $.ajax({
        type: "POST",
        url: uri.remove_item,
        data: {
            id: nid,
        },
        success: function(response) {
            if (response.status === 'success') {
                grid_container.jqxTreeGrid('deleteRow', nid);
            }
        }
    
    });

    jQWidgets version: 3.9.1

    Thank you!


    Hristo
    Participant

    Hello ebartashevich,

    Please, check the settings in your ‘ajax’, it is possible to enter in the error callback.
    Also, I would like to suggest you update to the latest version.

    Best Regards,
    Hristo Hristov

    jQWidgets team
    http://www.jqwidgets.com


    ebartashevich
    Participant

    Hi Hristo!

    Thank you for your advice!
    Just updated to latest bower version (4.5.0)

    Unfortunately, this problem still exists.

    My current code is below.
    I am getting ‘success’ message and correct nid value.

    How can I help to debug it?
    Thank you!

                    $.ajax({
                        type: "POST",
                        url: yii.uri.remove_item,
                        data: {
                            id: nid,
                            _csrf: $('meta[name="csrf-token"]').attr("content"),
                        },
                        success: function(response) {
    
                            if (response.status === 'success') {
                                
                                console.log('success!', nid);
                                grid_container.jqxTreeGrid('deleteRow', nid);
                            }
                        },
                        error: function(response) {
                            
                            console.log('error! ', response);
                        }                    
    

    ebartashevich
    Participant

    Hi!
    There is additional info:
    suppose when table loaded we have few rows with ids:

    
    -id:30
    --id:41
    --id:42
    -id:31
    --id:43
    -id:32
    -id:33
    

    1) when I click ‘delete’ for id:30 – row with id:30 is deleted with all children -> ok
    2) Then I add a new child to row id:33
    now it is

    
    -id:33
    --id:44
    

    when I click ‘delete’ for id:33 – nothing happens! -> Bug

    I’ve little bit debug the code.

    on row deletion, jqxdatatable.js:: deleterowbykey() is called
    check line 3027: “if (b.rowsByKey[c]) …”

    in case 1) b.rowsByKey contains data for rows 30,31,32,33, and code will find requested row & delete it
    in case 2) b.rowsByKey contains data only for row 44 (which is new added row), and it is why requested row is not deleted

    It seems bug somewhere in dataview.update() function (jqxdatatable.js :: line 617)


    Hristo
    Participant

    Hello ebartashevich,

    I try with this example and looks work fine.
    Could you provide us an example that demonstrates this issue?
    Thank you for the interest to us.

    Best Regards,
    Hristo Hristov

    jQWidgets team
    http://www.jqwidgets.com


    khawanz
    Participant

    Hi Hristo,

    I have same problem with different flow. I have function to add a row becoming child row. When i delete the child, it’s nothing happened. Apparently the issue come from as ebartashevich mentioned, “if (b.rowsByKey[c]) …”.. that make me come here after debug jqxdatatable.js.
    My question is how do i insert all row key into rowsByKey since the requested row key is missing in rowsByKey variable?

    FYI,
    Hristo, your example did not meet ebartashevich case that he mention the issue happened after Ajax call.

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

You must be logged in to reply to this topic.