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

Community Tip - New to the community? Learn how to post a question and get help from PTC and industry experts! X

how to reset selected rows in grid-Advanced widget via JSON Configuration

Rocky_2021
6-Contributor

how to reset selected rows in grid-Advanced widget via JSON Configuration

Hi,
I am using "gridAdvaced" widget in Thingworx (9.0) Mashup.


The grid configuration is written in one service.


In the service JSON is created with following code to clear the selection of grid :

 

"columns":{
.
.
.
},

"rows":
{
"selection":"multi",
"defaultSelectedRows":(NoOfRecords+1).toString(),
"autoScroll":false
},

"styles":{
.
.
.
}

 

 

 

I want the selected rows to get disselected whenever I change the page/ or data in the grid is changed.


The service is triggered on grid view button and page change event.

But if I select any row in the grid and then change the page or click the view button again (to trigger the configuration service), the selected row remain selected even if the data in the grid is changed.

Please suggest a workable solution ASAP.

Thank you in advance.

 

1 ACCEPTED SOLUTION

Accepted Solutions
GunwantP
6-Contributor
(To:Rocky_2021)

Hi @Rocky_2021 ,

You can create a service/function to set the "DefaultSelectedRows" property of grid-Advanced widget.

The service/function will return (number of records +1) or (some big value like 99999). (PFA)


To make this work in your case :

  1. Please remove the configuration binding,
  2. then bind the above mentioned binding and
  3. rebind the configuration,
  4. Trigger the above service/function on reequired events, page change event, button click event.

This work-around must work.
& PTC have resolved this issue in later versions so if you are using 9.1 or later, Reset property of grid-Advanced widget will also work.

 

Thanks

View solution in original post

4 REPLIES 4
jensc
17-Peridot
(To:Rocky_2021)

Hello,

 

My immediate thought is to use the "Reset" event on the advanced grid.
But I wonder if it would work for your specific use case? 

 

Another option could be (I haven't tested this myself) to add a service that has an empty infotable of the same data shape as your grid and put it as the selected rows in the advanced grid each time you do something where you want to remove the selected rows.

 

Hope this gives you some inspiration to find a solution.

 

Regards,

Jens

Rocky_2021
6-Contributor
(To:jensc)

  • Reset functionality is also not working to clear the selection.
  • Loading empty infotable and reloading the data infotable takes few seconds, and it does not look good aesthetically.

But thanks for your suggestion, I will try to find some more ways to find solution/work-around for this.

 

Meanwhile anyone can please find the solution and share it.


Thanks

GunwantP
6-Contributor
(To:Rocky_2021)

Hi @Rocky_2021 ,

You can create a service/function to set the "DefaultSelectedRows" property of grid-Advanced widget.

The service/function will return (number of records +1) or (some big value like 99999). (PFA)


To make this work in your case :

  1. Please remove the configuration binding,
  2. then bind the above mentioned binding and
  3. rebind the configuration,
  4. Trigger the above service/function on reequired events, page change event, button click event.

This work-around must work.
& PTC have resolved this issue in later versions so if you are using 9.1 or later, Reset property of grid-Advanced widget will also work.

 

Thanks

Rocky_2021
6-Contributor
(To:GunwantP)

Thanks Buddy, This is working as expected.

Top Tags