Skip to main content
11-Garnet
December 17, 2020
Solved

Widget Development - Infotable as Source - Selected Row Binding

  • December 17, 2020
  • 3 replies
  • 4554 views

I successfully created a widget with an infotable as bindingSource. I now want to use the Thingworx SelectedRows mechanism. E.G Collection Widget is bound to my widgets infotable. The selection within the collection widget should be propagated back to my widget where then another widget or service can consume the selected rows.

 

I already debugged most of the TWX JS, so far I have questions about

isBindingBoundToSelectedRows(e) ... how do I have to write my property description in order to use the native mechanism?

(or)

do I manually have to register a listener to the dataMgr myself? 
as in s.mashup.dataMgr.addSelectedRowsForWidgetHandleSelectionUpdateSubscription(e, (function(t, i, n) ...

 

Best answer by slangley

Hi everyone.

 

This is a rather old thread that resulted in a case being opened.  For the greater community, I wanted to advise that R&D confirmed that our widgets do not send a callback to the source widget to avoid an infinite callback loop. This is by design.  They recommend the use of a "companion" widget.

 

Regards.

 

--Sharon

 

3 replies

5-Regular Member
December 17, 2020

Hello,

 

I may be wrong here, but as far as I know the selected rows mechanism is only available for infotables bound from services or mashup parameters.

 

For infotables created locally by the widget, one possible approach is to also expose the selected rows as a separate property.

gbirnzain11-GarnetAuthor
11-Garnet
December 17, 2020

Yeah, well the collection widget (for example) only manipulates the selected rows property of the source. It does not care if it is a service or not as long as it's property name is [SelectedRows] (or something along the line).

 

Sure, I could expose a separate "Selected Rows" property but the selection of a row within the collection widget won't be propagated to it because the collection widget's selected items property is a binding target.

Also in reply to your statement, I do not want to offer the selected rows of my own widget but to consume the selected rows of the widget that binds the created infotable. 

I hope this clears this up.

 

It looks to me, that it is very well possible to get it to work if a.) the widget propertyname is correctly formatted and / or b.) I could register an own selectionchanged listener on the mashups dataMgr / databindingManager object. Any devs that could help me with that out there?  

Support
December 17, 2020

Hi @gbirnzain.

 

We're not clear on the use case.  Can you provide some detail around that so we can better understand your needs?  Providing some screenshots showing your current config, possibly with some detail on how you want things to be bound, would be helpful.

 

Regards.

 

--Sharon

gbirnzain11-GarnetAuthor
11-Garnet
December 21, 2020

My widget consists of multiple dropdowns. Data Property is Source for the collection widget.

 

What I want:

Selecting an item within the collection widget should trigger the selected row changed mechanism

What I need: 

How do I have to code my widget in order to get a bindable Selected Row property with my Data Infotable (not a separate property). Do I have to manually register a listener on the mashups dataMgr to get the Selection Changed Event from the collection widget?

 

Untitled.png

slangleyCommunity ManagerAnswer
Support
January 10, 2022

Hi everyone.

 

This is a rather old thread that resulted in a case being opened.  For the greater community, I wanted to advise that R&D confirmed that our widgets do not send a callback to the source widget to avoid an infinite callback loop. This is by design.  They recommend the use of a "companion" widget.

 

Regards.

 

--Sharon