jQWidgets Forums

jQuery UI Widgets Forums General Discussions After delete row page back to first page

This topic contains 6 replies, has 3 voices, and was last updated by  Peter Stoev 6 years, 4 months ago.

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

  • nigelwright7558
    Participant

    If I delete say row 500 then on updating the bound data the display then reverts back to page 0 row 0.
    Is there a way to keep it on the same page as the row that was deleted ?
    I have done a big search but cant find any fixes for this.
    Any help would be appreciated.


    admin
    Keymaster

    Hi nigelwright7558,

    After deleterow, the Grid component is re-rendered and goes to initial state. You can do this: save the page number, call deleterow, use gotopage(your page number).

    Regards,
    Peter


    nigelwright7558
    Participant

    I have done as you suggested but it still goes to page 0.

    I event tried using the bind event to goto a page but that doesnt work either.
    The problem seems to be the deleterow is an asynchronous event and returns before it has done anything causing the page to always be zero.
    I tried making the event synchronous but that made no difference.

    If I make a button that goes to page 0 that works fine, I just cant get it to do it after a deleterow or addrow event.

    After delete row page back to first page #103079

    Peter Stoev
    Keymaster

    Hi nigelwright7558,

    deleterow is not async. I suppose you do something else, because by default it does not even go to page 0 and is not required to use gotopage. I prepared an example which demonstrates that: http://jsfiddle.net/gLrynzqc/

    Regards,
    Peter


    nigelwright7558
    Participant

    If I don’t do updatebounddata the screen is out of date.
    If I do updatebounddata the screen is correct but it always goes back to page 0.
    The code just goes away and deletes the rows in the database.

    `
    //////////////////////////////
    // delete row

    deleterow: function (rowid, commit) {

    var cx;
    for (cx = 0; cx < rowid.length; cx++) {

    $.ajax({
    url: ‘@Url.Action(“deleterow”, “Home”)’,
    type: ‘POST’,
    contentType: ‘application/json;’,
    data: JSON.stringify({
    id2: rowid[cx]
    }),

    success: function (valid) {
    $(“#jqxgrid”).jqxGrid(‘updatebounddata’, ‘data’);
    commit(true);
    },
    error: function () {
    alert(‘error!’);
    }
    });
    }
    }


    nigelwright7558
    Participant

    I am not sure what I have done but it is now working ok.
    Another problem I found with column width not changing suddenly just fixed itself !!
    Must be a cache or refresh problem.

    After delete row page back to first page #103121

    Peter Stoev
    Keymaster

    We recently released version 6.2.0. If you’re installing through NPM, may be this resolved it.

    Thanks for the update.

    Regards,
    Peter

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

You must be logged in to reply to this topic.