Community Tip - Want the oppurtunity to discuss enhancements to PTC products? Join a working group! X
Hello, I have implemented pagination on a collection and services are written as per https://www.ptc.com/en/support/article/CS311123
Here If the user changes the number of Items in a Page using a drop down menu , it will also work , but the number of pages on the widget doesn't change . That is if the widget have 1 to 5 pages at first , then if we increase the page size using dropdown, the pagination widget still have 1 to 5 pages , the total number of pages will not decrease ,even though the page will shows the selected number of items.This leads to blank pages.
Is there any ways to which number of Items in per Page can be changed from the mashup.
Solved! Go to Solution.
Hello,
From your description it sounds like your code is working just fine based on the drop down value change and the number of rows you see on the current page.
I took a look at the paging widget from the version the article was written, ThingWorx Asset Advisor 8.3.2, and the number of items per page is not a bindable property. If it was, you would have to also bind the number of items per page to this property as well as the input to your service.
In order to use the widget as you have describe you will need to create a small custom version making the number of items per page bindable. This should fix your issue or you can submit an enhancement idea to the ThingWorx Ideas page, https://community.ptc.com/t5/ThingWorx-Ideas/idb-p/thingworxideas
.
Thanks,
Travis
The paging widget is not a default widget for TWX, and the article includes some coding, so here's my guessing.
Your current issue is with # of pages. and 2 inpust are mentioned in your pagination entity: PageSize and CurrentPage
My Question:
1. What's the input for the Paging widget?
2. If the PageSize is set to 5 and 10 by default (not chosen through the list), does the Paging widget show different # of pages?
My Guess:
1. The problem is within Paging widget, it does not refresh after # changes
2. The problem is within script (if the widget has # as input)
3. The problem is within binding (if the widget has # as input)
1. There is Input Options to Paging Widget are Current Page and Total Items, both of them are outputs of the Service given below
var data = Data; //Input Data Table
var dataShort = Resources["InfoTableFunctions"].CreateInfoTableFromDataShape( {
infoTableName : "InfoTable",
dataShapeName : "MainDatashape" });
for( var x = ( CurrentPage * PageSize ); x < data.getRowCount() && dataShort.getRowCount() < PageSize; x++ )
{
dataShort.AddRow( data.getRow( x ) );
}
var result = Resources["InfoTableFunctions"].CreateInfoTableFromDataShape( {
infoTableName : "InfoTable",
dataShapeName : "PaginationDS" } );
result.AddRow( {CurrentPage:CurrentPage, TotalItems:data.getRowCount(), Data:dataShort} );
2. If I set Page Size to 5 and I have 10 things to Display , the Pagination Widget Will Show "Pages :1 2".
But if I change the Page size to 10 from the Mashup and still have 10 things to show, it will still show "Pages : 1 2" with 2nd page left blank and page will show 10 items.
What I need is a solution to change page size from the Mashup effectively without blank pages coming.
Thank You
What I get from your testing is that the problem is possiblity with the Paging widget itself.
Track if there's any refresh features in the widget, after you changed pageSize from 5 to 10 and page# from 2 to 1. Or else your problem won't be fixed.
Hello,
From your description it sounds like your code is working just fine based on the drop down value change and the number of rows you see on the current page.
I took a look at the paging widget from the version the article was written, ThingWorx Asset Advisor 8.3.2, and the number of items per page is not a bindable property. If it was, you would have to also bind the number of items per page to this property as well as the input to your service.
In order to use the widget as you have describe you will need to create a small custom version making the number of items per page bindable. This should fix your issue or you can submit an enhancement idea to the ThingWorx Ideas page, https://community.ptc.com/t5/ThingWorx-Ideas/idb-p/thingworxideas
.
Thanks,
Travis
Thank You for your response
Hi @the_incapit.
If one of the previous responses answered your question, please mark the appropriate one as the Accepted Solution for the benefit of others with the same question.
Regards.
--Sharon
Thank You, I have Done it