diff --git a/examples/TaoQuickShow/Contents/General/Tables.qml b/examples/TaoQuickShow/Contents/General/Tables.qml index db26a39..08d4071 100644 --- a/examples/TaoQuickShow/Contents/General/Tables.qml +++ b/examples/TaoQuickShow/Contents/General/Tables.qml @@ -67,6 +67,84 @@ Item { } } + //12 items in one page + property int itemCountPerPage:12 + property int currentPage:1 + + //Pages round down + property int page:cusView.count/itemCountPerPage + + //Actual number of pages (exactly divide pageCount = page, otherwise pageCount is 1 page more than page) + property int pageCount: page*itemCountPerPage=cusView.count - 1?cusView.count - 1:currentViewIndex + + console.log("nextViewIndex ",currentViewIndex) + + cusView.positionViewAtIndex(currentViewIndex,ListView.Beginning) + + } + } + + //--Calculate page number + function showPage(){ + var currentViewIndex = cusView.indexAt(cusView.contentX,cusView.contentY) + if(currentViewIndex%itemCountPerPage!==0){ + //the last page + console.log("final") + currentPage = pageCount + }else{ + for(var i = 0; i 0 ? (cusHeader.x + cusHeader.xList[cusHeader.splitingIndex + 1]) : 0 y: cusView.y @@ -290,6 +369,26 @@ Item { deviceAddModel.deselectAll() } } + CusButton_Blue { + width: 120 + text: qsTr("Last Page") + trans.transString + onClicked: { + mainItem.lastpage() +// changePage(false) +// showPage() + } + } + CusButton_Blue { + width: 120 + text: qsTr("Next Page") + trans.transString + onClicked: { + mainItem.nextpage() +// changePage(true) +// showPage() + } + } + + } } CusTextField { diff --git a/examples/TaoQuickShow/Trans/language_zh.json b/examples/TaoQuickShow/Trans/language_zh.json index acfdf6d..6b92ede 100644 --- a/examples/TaoQuickShow/Trans/language_zh.json +++ b/examples/TaoQuickShow/Trans/language_zh.json @@ -601,6 +601,14 @@ { "key": "Clear All", "value": "清空" + }, + { + "key": "Last Page", + "value": "上一页" + }, + { + "key": "Next Page", + "value": "下一页" } ] }