jQuery UI Widgets Forums Grid Question about deleterow method

Tagged: ,

This topic contains 10 replies, has 3 voices, and was last updated by  Roberto 9 years, 10 months ago.

Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
  • Question about deleterow method #52231

    Roberto
    Participant

    I have a question regarding deleterow and why in my grid I could still see intermittently the deleted row item when I do some column sorting.

    First, here is how I add a row in my grid.

    $("#current_order").jqxGrid('addrow', null, value[key]);

    And here is how I delete the row.

    function _delete_row(){
       var selectedrowindex = $("#current_order").jqxGrid('getselectedrowindex');
       var id = $("#current_order").jqxGrid('getrowid', selectedrowindex);
       $("#current_order").jqxGrid('deleterow', id);
       $('#current_order').jqxGrid('refreshdata');
       $('#current_order').jqxGrid('refresh');
    };

    It will delete the row successfully, however, when I do random column sorting there are times that the deleted row still visible in the grid. The reason I include refreshdata and refresh method is I’m trying to refresh the grid of its data. I’m not sure if I’m using the correct method for this purpose. Any help that leads me to right direction is highly appreciated.

    Thanks
    Roberto

    • This topic was modified 9 years, 11 months ago by  Roberto.
    • This topic was modified 9 years, 11 months ago by  Roberto.
    Question about deleterow method #52235

    Peter Stoev
    Keymaster

    Hi Roberto,

    The following should be removed:

    $('#current_order').jqxGrid('refreshdata');
    $('#current_order').jqxGrid('refresh');
    

    They are not necessary.

    Also check whether you use jQWidgets 3.2.2.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

    Question about deleterow method #52271

    Roberto
    Participant

    Hi Peter,

    Thanks for the tips. I already removed the two methods and update to 3.2.2

    Here’s what I observed and here is my example grid.

    Code   Brand      Size    Quantity  Action
     008    Nekoosa    letter            Delete
     003    Husky      letter            Delete
     009    Hammermill letter            Delete

    I tried to delete “009” and successfully delete it from the grid and as expected only 003 and 008 should be left. However, when I tried to sort the Brand column I see 009 appearing back in the grid. Is there a need to redraw the table as it seems that the item is still in the grid “memory”?

    Thanks
    Roberto

    • This reply was modified 9 years, 11 months ago by  Roberto.
    Question about deleterow method #52277

    Peter Stoev
    Keymaster

    Hi Roberto,

    If you experience some kind of issue, then please provide a sample which illustrates it. You can use jsfiddle.net to prepare the sample and share it.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

    Question about deleterow method #52278

    ziggy
    Participant

    Hi Peter and Roberto,

    I also experienced this weird scenario when I am using drag and drop functionality in my jqxgrid.

    Would you mind sharing your fix on this?

    Thanks and regards,

    Karen

    Question about deleterow method #52279

    Peter Stoev
    Keymaster

    Hi Karen,

    As you can see, I requested for a sample. If you have the same issue, then share a sample in http://jsfiddle.net/.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

    Question about deleterow method #52290

    Roberto
    Participant

    Hi Peter,

    To illustrate my problem here is an example in jsfiddle http://jsfiddle.net/2E9J9/3/

    There are two tables in the example (i.e. The DRAG and DROP table). The DRAG table accepts multiplerows selection. I would then select any rows from it and drop them to DROP table below. Select a row and then delete and the row should be removed from the grid. After further testing I observed that the issue occurs after doing next deletion. After the second delete operation try to sort from any column and notice the deleted row appears back in the grid.

    If you need further details please let me know and I will add it in fiddle. This is my first time using jsfiddle please let me know if you have problem viewing it.

    Thanks,
    Roberto

    Question about deleterow method #52291

    Peter Stoev
    Keymaster

    Hi Roberto, Karen (same IP address).

    Here’s how this should be implemented: http://jsfiddle.net/LVEGK/

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

    Question about deleterow method #52294

    ziggy
    Participant

    Hi Peter,

    We are actually working in the same company (that’s why we share the same ip address). 🙂 But we are two different developers. 🙂

    I tried testing the jsfiddle link you sent but still same error occurred.

    Kind regards,
    Karen

    Question about deleterow method #52299

    Peter Stoev
    Keymaster

    Hi Karen,

    Thanks for the update. It seems you’re right. The simple workaround is to remove the sorting when you delete a row. http://jsfiddle.net/LBubN/

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

    Question about deleterow method #52544

    Roberto
    Participant

    Hi Peter,

    As per your workaround I just disabled the sorting method in the grid. Hope we could still use sorting after deleting the grid row maybe an update soon.

    Appreciate your assistance and thank you very much.

    Roberto

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

You must be logged in to reply to this topic.