Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    ListGrid ForeignKey show display value not value

    Is it possible to do the following?

    Using a DataSource with a ListGrid I would like to show the display value in the View instead of the value from the FK.

    I know when I click on the ListGrid for Editing the dropdown shows a table between my value and display value, if I make a choice the value shown goes back to the value and not the display value.

    In a DynamicForm the values shown are the displayed values.

    Thank you,

    #2
    See the docs for ListGridField.optionDataSource for approaches.

    Comment


      #3
      Thank you, am I correct in ...

      Originally posted by Isomorphic
      See the docs for ListGridField.optionDataSource for approaches.
      From what I'm reading am I correct in that the DataSource should only be two fields one for the Value and one for the Display?

      http://www.smartclient.com/smartgwt/javadoc/com/smartgwt/client/widgets/grid/ListGridField.html#setOptionDataSource(com.smartgwt.client.data.DataSource)

      If my main ListGrid has a DataSource with this field:

      Code:
      intField = new DataSourceIntegerField("roleid");
      		time = System.currentTimeMillis();
      		intField.setEditorType(new RoleSelectItem(time));
      		name = "roleds_"+time;
      		intField.setForeignKey(name+".roleid");
      		intField.setTitle("Role ID");
      		intField.setPrimaryKey(true);
      		intField.setCanEdit(false);
      		addField(intField);
      and I want that to show the displayValue from my data in the ListGrid at view time (and still use RoleSelectItem during editing time)

      I would create a new DataSource with the valueField and displayField only?

      When I use the ListGrid I setOptionDataSource on my ListGridField, using this new DataSource with only two fields?

      Thank you for your help

      Comment

      Working...
      X