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.
-
Author
-
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.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,
PeterI 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.
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,
PeterIf 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 rowdeleterow: 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!’);
}
});
}
}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.We recently released version 6.2.0. If you’re installing through NPM, may be this resolved it.
Thanks for the update.
Regards,
Peter -
AuthorPosts
You must be logged in to reply to this topic.