cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Help us improve the PTC Community by taking this short Community Survey! X

Setting pagNumber via sessionVariable on load of mashup

oskarberntorp
13-Aquamarine

Setting pagNumber via sessionVariable on load of mashup

Hi,

I am currently working on a project where we want the pageNumber to be controled via a session variable.

When for example selecting an item and then clicking back, we want the last viewed pagination page to show. The property pageNumber is updated correctly when switching pagination page. But when clicking an item and back, it is not taking into account the last pagination page,

How to solve this?

// Oskar Berntorp

ACCEPTED SOLUTION

Accepted Solutions

Hi @oskarberntorp 

 

Step1: Create a session parameter to hold the last visited page number.

Create a property in ThingShape:GlobalSessionProperties say "LastVisitedPage" of type number.

 

Step2: Create a service to update the last visited page that triggered by PageNumberChanged event of the pagination widget.

 

Step3: Create a service to fetch the last visited page and bind the output to PageNumber property of the pagination widget.

 

Step4: Bind the ServiceInvokeCompleted event of the service that returns Total # of results and page size to GetPageNumber service that created in Step 3

This is important because if you trigger the GetPageNumber service on Mashup loaded, the page number cannot be passed onto pagination widget successfully as without knowing the total number and page size, the pagination widget don't know how many pages it can have and will regard the passed PageNumber is invalid which lead to page number being 1

Tony

View solution in original post

1 REPLY 1

Hi @oskarberntorp 

 

Step1: Create a session parameter to hold the last visited page number.

Create a property in ThingShape:GlobalSessionProperties say "LastVisitedPage" of type number.

 

Step2: Create a service to update the last visited page that triggered by PageNumberChanged event of the pagination widget.

 

Step3: Create a service to fetch the last visited page and bind the output to PageNumber property of the pagination widget.

 

Step4: Bind the ServiceInvokeCompleted event of the service that returns Total # of results and page size to GetPageNumber service that created in Step 3

This is important because if you trigger the GetPageNumber service on Mashup loaded, the page number cannot be passed onto pagination widget successfully as without knowing the total number and page size, the pagination widget don't know how many pages it can have and will regard the passed PageNumber is invalid which lead to page number being 1

Tony
Announcements


Top Tags