Author Topic: Pagination column number in 2nd Page  (Read 5077 times)

Akihiro Inoue

  • Pro Ultimate
  • Newbie
  • *
  • Posts: 32
    • View Profile
Pagination column number in 2nd Page
« on: August 15, 2017, 11:51:54 am »
Hi,

I am trying to add a new row by clicking a button. The column number is udpated wrongly in 2nd page onwards in pagination

In case of 2nd page(in pagination)

Start Row - 51
End ROw - 100

 if i add a row like below
Add a row at 53

After row added, the column number will be updated automatically like this
Start Row - 52
End Row -101
New Row added at 54

Note -
1. No issues with page no -1
2. Server side pagination with row per page 50

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: Pagination column number in 2nd Page
« Reply #1 on: August 15, 2017, 05:02:27 pm »
I'm unable to reproduce the issue in remote paging example here: https://paramquery.com/pro/demos/editing

Please share a test case.

Akihiro Inoue

  • Pro Ultimate
  • Newbie
  • *
  • Posts: 32
    • View Profile
Re: Pagination column number in 2nd Page
« Reply #2 on: August 31, 2017, 04:39:56 pm »
Hi,
Thank you for your support.

I understand the issue. Please find the below use case in detail.

1. Remote Pagination with 1 to 50 and RPP is 50
2. In case if 'n' row is added in the page, then RPP will be updated as (50+n) dynamically
(If the RPP is not updated, then last 'n' rows will be moved to next page)

This case working fine in first page. But facing column number issues(explained in previous reply) only in second page onward.

Please let us know, if there is any other option to add rows without going to second page.





paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: Pagination column number in 2nd Page
« Reply #3 on: August 31, 2017, 10:22:17 pm »
Quote
2. In case if 'n' row is added in the page, then RPP will be updated as (50+n) dynamically
(If the RPP is not updated, then last 'n' rows will be moved to next page)

I don't understand how you have implemented this. Please share your implementation code.

If you want to see working example on how to add rows correctly in remote paging: https://paramquery.com/pro/demos/editing
« Last Edit: August 31, 2017, 10:40:13 pm by paramquery »

jeeva

  • Newbie
  • *
  • Posts: 29
    • View Profile
Re: Pagination column number in 2nd Page
« Reply #4 on: September 01, 2017, 12:41:12 pm »
Dear support,

1.Page current pagination 50
2.We are trying to add 50 new rows in same page.
3.After 50 records its trying to accommodate in 2nd page,We can able to see the records in 2nd page if its local pagination.
4.When comes to server side pagination its not possible. So when we add new records we are trying to change the pagination dynamically based on the added row count using the below code.
for (var i = 0, len = gridData.length; i < len; i++) {
                                         var rowData = gridData;
                                         if (rowData.ck) {
                                                indexPos = (curPage - 1)* rpp + i;
                                                checked.push(indexPos);
                                         }
                                  }
                                  var newRpp = obj.grid.option("pageModel.rPP");
                       
                       if((gridData.length +checked.length) > newRpp){
                              obj.grid.option("pageModel.rPP",(parseInt(newRpp)+checked.length));
                              rppChanged = true;
                              obj.grid.refreshView();
                       }
Expectation : Need to stay all the newly added records in same page with proper number cell count.

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: Pagination column number in 2nd Page
« Reply #5 on: September 01, 2017, 09:05:39 pm »
your code doesn't show how are you adding new rows to the grid.

Please add this code, which I've written as per your description in this https://paramquery.com/pro/demos/paging and click on 'Edit and Run' button.

Code: [Select]
toolbar: {
items: [
{
type: 'button',
label: 'Add new rows',
listener: function(){
//debugger;
var offset = this.getRIOffset();
rowList = [1,2,3,4,5].map(function(i, indx){
return {newRow: {CustomerName: i}, rowIndx: indx+offset };
});
var newRPP = this.option('pageModel.rPP')*1 + rowList.length;
var newRPPOptions = this.option('pageModel.rPPOptions')
newRPPOptions.push(newRPP)
newRPPOptions.sort(function(a,b){
return a - b}
);
this.option('pageModel.rPP', newRPP);
this.option('pageModel.rPPOptions', newRPPOptions);
this.addRow(
{rowList:rowList}
)
}
}
]
}

jeeva

  • Newbie
  • *
  • Posts: 29
    • View Profile
Re: Pagination column number in 2nd Page
« Reply #6 on: September 07, 2017, 06:02:30 pm »
Dear Support,

1.In 2nd page index starts from 11 - 20
2.When I try to add 5 new records its changing from 16 - 30.

Expected result - 11-25 not 16 -30.
In 1st page its working fine whatever records get added.

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: Pagination column number in 2nd Page
« Reply #7 on: September 07, 2017, 07:54:44 pm »
It's the expected behavior because when records per page is changed to 15 that means 15 records on each page,

There can't be 10 records on 1st page and 15 records on 2nd page.

DotNetRocks

  • Pro Ultimate
  • Newbie
  • *
  • Posts: 7
    • View Profile
Re: Pagination column number in 2nd Page
« Reply #8 on: September 08, 2017, 09:32:48 pm »
your code doesn't show how are you adding new rows to the grid.

Please add this code, which I've written as per your description in this https://paramquery.com/pro/demos/paging and click on 'Edit and Run' button.

Code: [Select]
toolbar: {
items: [
{
type: 'button',
label: 'Add new rows',
listener: function(){
//debugger;
var offset = this.getRIOffset();
rowList = [1,2,3,4,5].map(function(i, indx){
return {newRow: {CustomerName: i}, rowIndx: indx+offset };
});
var newRPP = this.option('pageModel.rPP')*1 + rowList.length;
var newRPPOptions = this.option('pageModel.rPPOptions')
newRPPOptions.push(newRPP)
newRPPOptions.sort(function(a,b){
return a - b}
);
this.option('pageModel.rPP', newRPP);
this.option('pageModel.rPPOptions', newRPPOptions);
this.addRow(
{rowList:rowList}
)
}
}
]
}

support, I am trying to do the similar thing as the requester.

However, when I add the getRIOffset(), I get errors that it is not a function. is this something new?

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: Pagination column number in 2nd Page
« Reply #9 on: September 11, 2017, 04:52:57 pm »
getRIOffset is a method in version 4 to get rowIndx offset of current page from page 1,  it's same as getRowIndxOffset in version 3.