Fixes bug preventing pagination click

This commit is contained in:
Samuel Georges 2016-01-16 16:20:33 +11:00
parent 3cfc7b6a5d
commit f2699a7039
3 changed files with 14 additions and 12 deletions

View File

@ -3,7 +3,7 @@
/** /**
* The client-memory data source for the Table widget. * The client-memory data source for the Table widget.
*/ */
class ClientMemoryDataSource extends TableDataSourceBase class ClientMemoryDataSource extends DataSourceBase
{ {
/** /**
* @var array Keeps the data source data. * @var array Keeps the data source data.

View File

@ -423,7 +423,8 @@ if(newPaginationContainer||curRecordCount!=recordCount){paginationContainer.setA
var pageList=this.buildPaginationLinkList(recordCount,this.tableObj.options.recordsPerPage,this.pageIndex) var pageList=this.buildPaginationLinkList(recordCount,this.tableObj.options.recordsPerPage,this.pageIndex)
if(!newPaginationContainer){paginationContainer.replaceChild(pageList,paginationContainer.children[0])} if(!newPaginationContainer){paginationContainer.replaceChild(pageList,paginationContainer.children[0])}
else{paginationContainer.appendChild(pageList) else{paginationContainer.appendChild(pageList)
this.tableObj.getElement().appendChild(paginationContainer)}}else{this.markActiveLinkItem(paginationContainer,this.pageIndex)}} this.tableObj.getElement().appendChild(paginationContainer)}}
else{this.markActiveLinkItem(paginationContainer,this.pageIndex)}}
Navigation.prototype.calculatePageCount=function(recordCount,recordsPerPage){var pageCount=Math.ceil(recordCount/recordsPerPage) Navigation.prototype.calculatePageCount=function(recordCount,recordsPerPage){var pageCount=Math.ceil(recordCount/recordsPerPage)
if(!pageCount) if(!pageCount)
pageCount=1 pageCount=1
@ -434,12 +435,12 @@ Navigation.prototype.buildPaginationLinkList=function(recordCount,recordsPerPage
for(var i=0;i<pageCount;i++){var item=document.createElement('li'),link=document.createElement('a') for(var i=0;i<pageCount;i++){var item=document.createElement('li'),link=document.createElement('a')
if(i==pageIndex) if(i==pageIndex)
item.setAttribute('class','active') item.setAttribute('class','active')
$(item).addClass('pagination-link')
link.innerText=i+1 link.innerText=i+1
link.setAttribute('data-page-index',i) link.setAttribute('data-page-index',i)
link.setAttribute('href','#') link.setAttribute('href','#')
item.appendChild(link) item.appendChild(link)
pageList.appendChild(item)} pageList.appendChild(item)
$(link).addClass('pagination-link')}
return pageList} return pageList}
Navigation.prototype.markActiveLinkItem=function(paginationContainer,pageIndex){var activeItem=paginationContainer.querySelector('.active'),list=paginationContainer.children[0] Navigation.prototype.markActiveLinkItem=function(paginationContainer,pageIndex){var activeItem=paginationContainer.querySelector('.active'),list=paginationContainer.children[0]
activeItem.setAttribute('class','') activeItem.setAttribute('class','')

View File

@ -88,10 +88,10 @@
paginationContainer.appendChild(pageList) paginationContainer.appendChild(pageList)
this.tableObj.getElement().appendChild(paginationContainer) this.tableObj.getElement().appendChild(paginationContainer)
} }
} else { }
else {
// Do not re-generate the pages if the record count hasn't changed, // Do not re-generate the pages if the record count hasn't changed,
// but mark the new active item in the pagination list // but mark the new active item in the pagination list
this.markActiveLinkItem(paginationContainer, this.pageIndex) this.markActiveLinkItem(paginationContainer, this.pageIndex)
} }
} }
@ -125,7 +125,6 @@
if (i == pageIndex) if (i == pageIndex)
item.setAttribute('class', 'active') item.setAttribute('class', 'active')
$(item).addClass('pagination-link')
link.innerText = i+1 link.innerText = i+1
link.setAttribute('data-page-index', i) link.setAttribute('data-page-index', i)
@ -133,6 +132,8 @@
item.appendChild(link) item.appendChild(link)
pageList.appendChild(item) pageList.appendChild(item)
$(link).addClass('pagination-link')
} }
return pageList return pageList
@ -211,9 +212,9 @@
newRow = !ev.shiftKey newRow = !ev.shiftKey
? row.nextElementSibling ? row.nextElementSibling
: row.parentNode.children[row.parentNode.children.length - 1], : row.parentNode.children[row.parentNode.children.length - 1],
cellIndex = forceCellIndex !== undefined ? cellIndex = forceCellIndex !== undefined
forceCellIndex : ? forceCellIndex
this.tableObj.activeCell.cellIndex : this.tableObj.activeCell.cellIndex
if (newRow) { if (newRow) {
var cell = newRow.children[cellIndex] var cell = newRow.children[cellIndex]