开发者

delete grid row

i have a simple grid with data from mysql db.

When delete a record actually refresh the page.

When i am at last p开发者_如何学Cage and start delete records after delete all records when refresh i get no data because i dont have any records on that page.

So some how i must find a way when i am on last page and all record deleted refresh to previous page.

Any ideas

thanks


in your code where you get the current page, compare it to the max pages

$currentPage = (int) $_GET['page'];
$currentPage = ($currentPage <= $maxPages) ? $currentPage : $maxPages;


Do a simple count on the rows to be displayed.

if ($row_count == 0)
    ... redirect to previous page

make sure you allow for there actually being no records to be displayed on the first page.


var currentPageNumber = $("#GridName").data("kendoGrid").dataSource.page();

$("#GridName").data("kendoGrid").dataSource.page(currentPageNumber - 1);

Put above two lines after your delete logic is completed.
It worked for me

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜