Skip to main content
1-Visitor
October 12, 2016
Solved

Selected drop down value on mashup load

  • October 12, 2016
  • 3 replies
  • 8819 views

I am loading some drop down lists with string values that are used to display a variety of values depending on the selection.

I have a data table that stores the settings per user so that each time the page is loaded the proper values are restored as they were last configured.  My data is being display correctly in my grid based on the saved values in the data table.  However, the selected value is not reflected/displayed in the list widget when the mashup is loaded.

I have tried a number of things to try to get the selected values to be shown in the list widget when the mashup loads, but so far I have not had any success.  I am attempting to use the SelectedText parameter, but this doesn't seem to be doing anything.  Do I need to create a list of numerical values to tie to the ValueField in order to get this working?

Please let me know what I am missing.  I have tried the same setup in two versions of ThingWorx Composer to make sure it wasn't an issue in my current version.

Thanks,

Pauls

Best answer by CarlesColl

Hi Paul,

What you are doing should work, I do it. Then you are doing something wrong, my two cents:

  1. SelectedText should be ValueField not DisplayField, the name it's confusing I know.
  2. SelectedText should be filled before loading the List Data content ( better you trigger the service which fills the Data with ServiceInvokeCompleted from User Settings )
  3. Don't set AutoSelectFirstRow=true

Best Regards,

Carles

3 replies

5-Regular Member
October 12, 2016

I am a bit confused. What exactly is supposed to be showing in the drop down list? What does show in the drop down list instead?

pbaierl1-VisitorAuthor
1-Visitor
October 12, 2016

I have a list of parameters Thing 1 - Thing 10.  My drop down list loads the data correctly.

I can select any of the 10 things in the list without a problem.  When the selected row changes I update my data table to store the newly selected value.

The problem comes in when I navigate to another mashup and come back.  When the mashup loads again the drop down box is empty even though I have the SelectedText parameter linked to the previously selected value.

For example: 

I see when my mashup first loads.

I am trying to restore the last selected value when the mashup loads.

5-Regular Member
October 12, 2016

Ok, that makes a lot more sense. I am still confused about how you are keeping track of the last selected. I think from what I read above, you are pushing this value to a data table? That seems a little overkill. Usually data tables are used to store data for long periods of time and not transiently. Have you tried using session variables? How are you doing the navigation? You could use mashup parameters too if you use the navigation widget, potentially.

1-Visitor
October 13, 2016

Hi, did you try to:

- Create a service to retrieve from the DataTable the last value selected and to return this value as String

- In the mashup, bind the result of this service to the property SelectedText of the Dropdown widget

- Execute this service on Mashup load

1-Visitor
October 13, 2016

Hi Paul,

What you are doing should work, I do it. Then you are doing something wrong, my two cents:

  1. SelectedText should be ValueField not DisplayField, the name it's confusing I know.
  2. SelectedText should be filled before loading the List Data content ( better you trigger the service which fills the Data with ServiceInvokeCompleted from User Settings )
  3. Don't set AutoSelectFirstRow=true

Best Regards,

Carles

pbaierl1-VisitorAuthor
1-Visitor
October 13, 2016

Thanks Carles,

I will give this a shot.  I do not have anything selected in the ValueField.  I suspected that was my issue.

1-Visitor
October 13, 2016

You always have to have something on ValueField