Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
525
Deleting a row from the Ignite Grid doesn't cause the Pages to be re-calculated.
posted

Hello,

I have enabled paging on my grid. I am facing following issues:

1. If I am on the last page and there is only one record on the last page. And if I delete that record from the grid. The grid doesn't go to the previous page automatically. 

2. If:

total pages are: 9

pages size is: 10

total rows count is: 81

current page index is: 3

Now, if I delete a record from the page no. 3, then the pager is not automatically refreshed. And it still shows the total 9 pages. Ideally it should recalculate the total pages and show 8 pages.

I delete the row using the following code (is it the correct way to delete a row?):

$("#FWUserGrid").igGridUpdating("deleteRow", 123);

Any ideas how to achieve this behavior?

Regards,

Arfan Baig

Parents
  • 1015
    Suggested Answer
    posted

     That functionality depends on the autoCommit option of your grid I believe.

    You may need to do a databind after that as well.   Try this after the delete.  You will probably need to store the page number of the grid you are on and set it after the dataBind as well.  Try something like this possibly.  Hope it helps.

    var yourPageNumber = $("#grid").igGridPaging("pageIndex");

    var yourPageSize = $("#grid").igGridPaging("pageSize");

    $("#grid").igGrid("dataBind");

    var yourLocalRecordCount = $("#grid").data("igGrid").dataSource.totalLocalRecordsCount();

    var maxPage = Math.ceil((double)yourLocalRecordCount / yourPageSize);

    yourPageNumber = (yourPageNumber > maxPage) ? maxPage : yourPageNumber;

    $("#grid").igGridPaging("pageIndex", yourPageNumber);

Reply Children
No Data