Author Topic: Batch editing remote model  (Read 1621 times)

omerix

  • Pro Enterprise
  • Full Member
  • *
  • Posts: 148
    • View Profile
Batch editing remote model
« on: October 26, 2017, 04:58:33 am »
Hello,

When I made the following changes, I pressed the "New Product" button on a 3rd page grid. The bottom line is not opening a new line.
(dataModel, pageModel)

Sample: Total records:39

Do I have to make a change here?
Code: [Select]
{ type: 'button', icon: 'ui-icon-plus', label: 'New Product', listener: function () {
//var rowData = { ProductID: 34, UnitPrice: 0.2 }; //empty row
var rowData={};
var rowIndx = grid.addRow( { rowData: rowData, checkEditable: true });
grid.goToPage({ rowIndx: rowIndx });
grid.editFirstCellInRow({ rowIndx: rowIndx });                       
}
},



dataModel:
Code: [Select]
dataModel: {
dataType: "JSON",
method: "GET",
location: "remote",
recIndx: "ID",
url: "?isl=GridGetir",
getData: function (response) {
var data=response.data;
return { curPage: response.curPage, totalRecords: response.totalRecords, data: data };
}
}

pageModel:
Code: [Select]
pageModel: {
type: "remote",
curPage: 1,
rPP: 15,
rPPOptions: [1, 5, 10, 15, 25, 50, 100, 200]
},

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: Batch editing remote model
« Reply #1 on: October 26, 2017, 04:45:24 pm »
when pageModel.type is "remote" and new row is appended on any non last page, new row won't show because only rpp rows can exist on that page.

So instead of appending, try to prepend a new row ( rowIndxPage: 0 ) as in this example of remote pageModel.

Code: [Select]
grid.addRow({ rowIndxPage: 0, rowData: rowData, checkEditable: false });

https://paramquery.com/pro/demos/editing