mirror of
https://github.com/wintercms/winter.git
synced 2024-06-28 05:33:29 +02:00
Fixes bug preventing pagination click
This commit is contained in:
parent
3cfc7b6a5d
commit
f2699a7039
@ -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.
|
||||
@ -43,7 +43,7 @@ class ClientMemoryDataSource extends TableDataSourceBase
|
||||
* Return records from the data source.
|
||||
* @param integer $offset Specifies the offset of the first record to return, zero-based.
|
||||
* @param integer $count Specifies the number of records to return.
|
||||
* @return array Returns the records.
|
||||
* @return array Returns the records.
|
||||
* If there are no more records, returns an empty array.
|
||||
*/
|
||||
public function getRecords($offset, $count)
|
||||
|
@ -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','')
|
||||
|
@ -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
|
||||
@ -209,11 +210,11 @@
|
||||
|
||||
var row = this.tableObj.activeCell.parentNode,
|
||||
newRow = !ev.shiftKey
|
||||
? row.nextElementSibling
|
||||
? 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]
|
||||
|
Loading…
x
Reference in New Issue
Block a user