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

Community Tip - Stay updated on what is happening on the PTC Community by subscribing to PTC Community Announcements. X

How to access what was selected in Collection widget

HD_10225728
6-Contributor

How to access what was selected in Collection widget

Hello everyone,

I have a service that returns an infotable with a column that contains multiple rows with infotables.

 

I want to use a collection widget to display the nested infotables dynamically (depending on how many rows there are). 

 

The user is supposed to select something in one of the infotables. This selection, I want to use!

HD_10225728_0-1657208530767.png

HD_10225728_2-1657208671778.png

 

This were the bindings I created. But in the label which should display the selection data, nothing is displayed. Is this a bug or am I doing something wrong?

 

Note: please disregard [object object], I have set DisplayField, StateField, ValueField but for privacy reasons I took the screenshot before I set it.

 

I would appreciate any help!

 

Thank you!

 

6 REPLIES 6
abjain
13-Aquamarine
(To:HD_10225728)

@HD_10225728 : To the label, can you please try binding the SelectedText property of the list?

abjain_0-1657261272027.png

 

HD_10225728
6-Contributor
(To:abjain)

Thank you for your help! Sorry, I described it maybe not right.

 

I want to pass back what was selected in the static collection mashup, to the "main" mashup that contains the collection widget. 

HD_10225728_0-1657262065031.png

 

Ashritha
13-Aquamarine
(To:HD_10225728)

Hi,

 

MashupGlobalPropertyBinding property of Collection widget can be used to achieve above mentioned functionality.

Reference Link 

 

Hope this Helps!!

HD_10225728
6-Contributor
(To:Ashritha)

I don't understand how I can use MashupGlobalPropertyBinding to pass back what was selected.

 

 

I have done the following steps:

 

1. InfoTable property "myInfoTable" with a DataShape that has one column named "InfoTable" of Type InfoTable.

HD_10225728_3-1658734936184.png

 

2. Created Responsive Base Mashup with Collection Widget and Static Mashup with a List Widget.

 

3. Responsive Base Mashup: 

  • set Mashup Property to the Static Mashup
  • Bound GetProperties() -> All Data -> myInfoTable to Data of Collection Widget
  • Set UIDField to InfoTable

4. Static Mashup:

  • Created a Mashup Parameter "infotableData" with the DataShape of the contained InfoTable
  • Bound the Mashup Parameter to the List and set Display, Value, and StateField

 

5. Responsive Base Mashup

  • In MashupPropertyBinding defined the following JSON Code: 

{
"InfoTable" : "infotableData"
}

 

 

--> Success, the responsive mashup displays 2 Lists, one for each row of the nested InfoTables

HD_10225728_4-1658735134013.png

 

 

But this is where I'm then stuck. I want to use the SelectedItems properties and pass back to the responsive mashup, whatever the user has selected in one of the lists. How can this passing back be achieved? Or is collection widget only for displaying data?

 

Ashritha
13-Aquamarine
(To:HD_10225728)

Hi,

 

Property defined in MashupGlobalPropertyBinding  will create  property which can be bound (in both ways => child to parent mashup or parent to child mashup)

  • create a property selectedData by defining MashupGlobalPropertyBinding Json as below
    • {"selectedData" : "STRING"}
  • In child mashup, create selectedData as mashup parameter.
  • Bind selected text to selectedData in child mashup.
  • In Main Mashup, get the  selectedData  from property tab of collection widget and bind it as required.

 

Hope it helps!!

 

 

 

 

 

 

 

 

 

 

 

HD_10225728
6-Contributor
(To:Ashritha)

Hi Ashrita,

thank you so much for the steps!! Worked perfectly for passing the String data! 

 

Do you also know how to pass back a whole InfoTable? The format {"selectedRow": "INFOTABLE"} with a MashupProperty called "selectedRow" of type InfoTable (receiving selectedItems from ChildMashup) doesn't work.

 

I assume one also needs to give the DataShape name in the JSON Format.

I have found other users asking the same in the forum, but no solution was found.

 

Top Tags