From 3b786b1ecda7ac46b2bbcc80ce0e9a5717d47ca3 Mon Sep 17 00:00:00 2001 From: juanf <juanf> Date: Fri, 31 Oct 2014 09:29:13 +0000 Subject: [PATCH] SSDM-986 : PAPER - Refactor old tables to use the new one SVN: 32699 --- .../webapps/newbrowser/html/lib/grid/js/Grid.js | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/lib/grid/js/Grid.js b/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/lib/grid/js/Grid.js index 9f5aa173965..d2c2a4eb486 100644 --- a/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/lib/grid/js/Grid.js +++ b/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/lib/grid/js/Grid.js @@ -189,21 +189,17 @@ $.extend(Grid.prototype, { dataList = thisGrid.sortData(dataList, options.sortProperty, options.sortDirection); var result = {}; - var defaultPageSize = 50; - var startIndex = options.pageIndex * (options.pageSize || defaultPageSize); - var endIndex = startIndex + (options.pageSize || defaultPageSize); - endIndex = (endIndex <= result.count) ? endIndex : dataList.length; - result.count = dataList.length; result.datas = []; result.items = []; result.columns = thisGrid.getVisibleColumns(); result.page = options.pageIndex; - result.pages = Math.ceil(result.count / (options.pageSize || defaultPageSize)); - result.start = startIndex + 1; - result.end = endIndex; - - dataList = dataList.slice(startIndex, endIndex); + result.pages = Math.ceil(result.count / options.pageSize); + result.start = options.pageIndex * options.pageSize; + result.end = result.start + options.pageSize; + result.end = (result.end <= result.count) ? result.end : result.count; + + dataList = dataList.slice(result.start, result.end); itemList = thisGrid.renderData(dataList); itemList.forEach(function(item, index) { result.datas.push(dataList[index]); -- GitLab