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.
*/
class ClientMemoryDataSource extends TableDataSourceBase
class ClientMemoryDataSource extends DataSourceBase
{
/**
* @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)
if(!newPaginationContainer){paginationContainer.replaceChild(pageList,paginationContainer.children[0])}
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)
if(!pageCount)
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')
if(i==pageIndex)
item.setAttribute('class','active')
$(item).addClass('pagination-link')
link.innerText=i+1
link.setAttribute('data-page-index',i)
link.setAttribute('href','#')
item.appendChild(link)
pageList.appendChild(item)}
pageList.appendChild(item)
$(link).addClass('pagination-link')}
return pageList}
Navigation.prototype.markActiveLinkItem=function(paginationContainer,pageIndex){var activeItem=paginationContainer.querySelector('.active'),list=paginationContainer.children[0]
activeItem.setAttribute('class','')

View File

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