ParamQuery grid support forum

General Category => Help for ParamQuery Pro => Topic started by: emontes on June 11, 2016, 05:08:39 am

Title: Problem adding data
Post by: emontes on June 11, 2016, 05:08:39 am
I followed the example in http://paramquery.com/pro/demos/editing_instant

Everything works fine, but when I try to add an Item and is needed a new page the grid don't go to the page, in a previous post http://paramquery.com/forum/index.php?topic=1517.msg6597#msg6597 you helped me to change the remote data  paging, then in my toolbar I have:
 {
               type: 'button',
                icon: 'ui-icon-plus',
                label: 'Nuevo Tema',
                listener: function () {
                    //append empty row at the end.                           
                    var rowData = { topicname: 'nuevotema', topictext: 'Nuevo Tema' }; //empty row
                    var rowIndx = grid.addRow({ rowData: rowData });
                    grid.goToPage({ rowIndx: rowIndx });
                    grid.editFirstCellInRow({ rowIndx: rowIndx });
                }
            },

and in my dataModel,
 beforeSend: function(a, b) {
               b.url = b.url.replace("pq_curpage", "page");
            }, 

Then I supose that the problem is with the grid.goToPage. How can I make the grid to take the page ?
Title: Re: Problem adding data
Post by: paramvir on June 13, 2016, 09:42:52 am
Since auto save demo is based on local paging while you have been using remote paging, you can't expect same results.
You may require to make appropriate changes in your code.

Please check the value of rowIndx returned by addRow() method and compare it with number of records per page,

You may try to pass page number to goToPage() method instead of rowIndx
Title: Re: Problem adding data
Post by: emontes on June 14, 2016, 05:43:16 am
which method can I use to get the Last Page of the Grid?
Title: Re: Problem adding data
Post by: paramvir on June 14, 2016, 01:45:09 pm
That would be:

Code: [Select]
  grid.goToPage( { page: grid.option('pageModel.totalPages') } );