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

Community Tip - Want the oppurtunity to discuss enhancements to PTC products? Join a working group! X

How to set the "Selected Row(s)" in custom widget ?

seanccc
17-Peridot

How to set the "Selected Row(s)" in custom widget ?

Hi, 

I created a custom table widget ,  the widget can bind data and display well .  When the table row get selected , I can get the selected row(s),  but  how can I set the  rows to  the binding service's "Selected Row(s)" ?

 

I can defined a JSON property as selected value,  but I prefer the standard mashup  binding style for selected rows. 

 

seanccc_0-1590247876171.png

 

Regards,

Sean

 

1 ACCEPTED SOLUTION

Accepted Solutions

I think something like:

// -- yourWidget it's the javascript instance of your widget
// -- Where 'Data' it's the name of the infotable property on your widget
// -- [array..] --> if you have single select, something like [3] or multi select [0,3,8]
yourWidget.updateSelection('Data',[array of indexes to be selected]);

View solution in original post

4 REPLIES 4

I think something like:

// -- yourWidget it's the javascript instance of your widget
// -- Where 'Data' it's the name of the infotable property on your widget
// -- [array..] --> if you have single select, something like [3] or multi select [0,3,8]
yourWidget.updateSelection('Data',[array of indexes to be selected]);

@CarlesColl ,

 

Thank you for your hint.  While I found updateSelection indeed used to update the Selected Rows,  the widget.runtime.js must also has function "handleSelectionUpdate" defined , otherwise the runtime framework will assume that the widget doesn't care about selection update. 

 

one more question,  where do you get the following API comment ?   I couldn't find it in the ThingWorx Extension Development Guide . 

// -- yourWidget it's the javascript instance of your widget
// -- Where 'Data' it's the name of the infotable property on your widget
// -- [array..] --> if you have single select, something like [3] or multi select [0,3,8]

  

Regards,

Sean

It's my own one

got it . thank you for the sharing  : )

Top Tags