Skip to main content
10-Marble
April 17, 2023
Solved

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

  • April 17, 2023
  • 1 reply
  • 2695 views

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.

 

Best answer by GunwantP

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

1 reply

17-Peridot
April 17, 2023

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

10-Marble
April 18, 2023
  • 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

GunwantP10-MarbleAnswer
10-Marble
April 18, 2023

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