The grid is based on code from a sample client side grid but I'm having a problem with data hanging around after changing pages. For this sample, assume there's 215 lines of data but the grid is set to 200 lines. When the page changes to page 2, it correctly displays 15 lines on the screen but in the data structures that the javascript can access it sees 200 lines (which makes sense, I know the grid maintains it's original size even if it isn't showing all the lines) but all 200 lines have data bound to them (the first 15 are the new 15, the other 185 are left over from page 1).
Is it right that the extra lines on the second page still have data bound to them? The grid seems to know to only display the first 15, how do I in my code tell which lines I should be retrieving data from for my totals?
Thanks,
Sean
function GridCommand(sender, args) {
GetGridData(true);
}
function GetGridData(sendEnteredData) {
PageMethods.GetData(currentPageIndex, tableView.get_pageSize(), sortField, sortOrder, enteredData, updateGrid, errorInCall);
}
function updateGrid(result) {
var tableView = createGrid.get_masterTableView();
tableView.set_dataSource(result);
tableView.dataBind();
updateTotals();
}
function updateTotals() {
var items = createGrid.get_masterTableView().get_dataItems();
if (items != null && items.length > 0) {
for (var i = 0; i < items.length; i++) {
if (items[i].get_dataItem() != null) {
// I'm expecting only the first 15 lines would make it here if on the second page but all 200 still have data bound
}
}
}
}