Hi,
In one of my projects I have to display a Popup window with a grid (it is binded to a remote data source), allow the user to select
multiple rows from any of the grid's pages and copy them to another grid datasource when the user hit a button.
I have almost succeed in the way:
In one of my projects I have to display a Popup window with a grid (it is binded to a remote data source), allow the user to select
multiple rows from any of the grid's pages and copy them to another grid datasource when the user hit a button.
I have almost succeed in the way:
- I'm able to display both grid
- I have added a checkbox to each row to allow users to select rows
- store the Ids of my selected rows in a json string
- restore selection when user move from one page to another
- Get the list of selected Ids
The problem I have now is that I'm able to copy to the target datasource only the data items of the current page.
Herebelow is the javascript function I use to copy data item:
When copying item from a not displayed page, the item from the current page, with the same index is copied instead
Note that the ItemIdx and PageNb are correct, this was double checked.
what am I doing wrong ?
Herebelow is the javascript function I use to copy data item:
function moveTo(from, to) { for (var i in checkedIds) { var isFound = to.dataSource.get(checkedIds[i]); if (checkedIds[i] != "") { if (isFound == undefined) { // Set 'From' Datasource to the correct page var ItemIdx = i % from.dataSource.pageSize(); var PageNb = ((i - (ItemIdx)) / from.dataSource.pageSize()) + 1; //alert("Item: " + ItemIdx + " Page: " + PageNb); from.dataSource.page(PageNb); var view = from.dataSource.view(); var item = view[ItemIdx]; to.dataSource.add(item); } } }}When copying item from a not displayed page, the item from the current page, with the same index is copied instead
Note that the ItemIdx and PageNb are correct, this was double checked.
what am I doing wrong ?
