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

Community Tip - If community subscription notifications are filling up your inbox you can set up a daily digest and get all your notifications in a single email. X

How to add a query to a paginated grid advanced widget

Willie
16-Pearl

How to add a query to a paginated grid advanced widget

I followed the instructions in the link below to add pagination to grid advanced.  It works.

https://www.ptc.com/en/support/article/CS311123

 

I typically add the following code to add query to grid advanced.

 

 

	if (query) {
		result = Resources["InfoTableFunctions"].Query({
			t: result /* INFOTABLE */ ,
			query: query /* QUERY */
		});
	}    

 

 

 

For the paginated grid advanced, I tried the code below to match the output infotable, but it's not working.  Is there a way to add query to a paginated grid advanced?

 

 


	if (query) {
		result = Resources["InfoTableFunctions"].Query({
			t: result.Data /* INFOTABLE */ ,
			query: query /* QUERY */
		});
	}    

 

 

 

 

ACCEPTED SOLUTION

Accepted Solutions
Arun_C
16-Pearl
(To:Willie)

Hi @Willie , 

 

If I'm understanding you statement clearly, You need to query based on the main data and split it into pages?

 

Please take a look on the code snapshot it may hepls you. We added the "Query" snippet at top of the GetPaginatedEntires services with Input - "query" and then we formed the splitted pages row data based on the quired from main infotable - "data" & the serive were executed by 1 more event of "FilterChanged".

 

Arun_C_0-1691734140407.png

If Its not making sense means, Can you please ellaborate your query more for better understanding?

 

Thanks & Regards,

Arun C

 

View solution in original post

6 REPLIES 6
Arun_C
16-Pearl
(To:Willie)

HI @Willie ,

 

We tried with below given steps were worked for us-

If need query/filter the entires on each pages, after all paginated data are printed on pages means, we created 1 more service with 2 Inputs,

  1. Infotable input - to recive the data from the service GetPaginatedEntries - 'Data' Field 
  2. Query input - to collect the query fron grid widget

and Output as Infotable as same as in below snapshot to print the data to the GridAdvanced widget.

 

Arun_C_0-1691660141503.png

And bind the service exection events from GetPaginatedEntries - Invoke & Grid Filter Changed.

 

Arun_C_1-1691661869288.png

 

Thanks & Regards,

Arun C

Willie
16-Pearl
(To:Arun_C)

Hi @Arun_C 

 

The solution provided worked, but it only queried the current page.  It did not query the entire infotable.  Is there a way to query the entire infotable?

Arun_C
16-Pearl
(To:Willie)

Hi @Willie , 

 

If I'm understanding you statement clearly, You need to query based on the main data and split it into pages?

 

Please take a look on the code snapshot it may hepls you. We added the "Query" snippet at top of the GetPaginatedEntires services with Input - "query" and then we formed the splitted pages row data based on the quired from main infotable - "data" & the serive were executed by 1 more event of "FilterChanged".

 

Arun_C_0-1691734140407.png

If Its not making sense means, Can you please ellaborate your query more for better understanding?

 

Thanks & Regards,

Arun C

 

Willie
16-Pearl
(To:Arun_C)

Hi @Arun_C 

 

It works!  Thank you!

Hi @Willie,

 

Looking at your second code snippet instead of setting the return of the Query to result you should set it to result.Data, if your return from the service follows the support article.

 

if (query) {
	result.Data = Resources["InfoTableFunctions"].Query({
	t: result.Data /* INFOTABLE */ ,
	query: query /* QUERY */
    });
}

 

Thanks,

 

Travis

Oops.  I missed that.  Good catch!

Announcements


Top Tags