Announcement

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

    Problem with OptionDataSource on ListGridField

    Hi All,

    I have a problem with OptionDataSource on a ListGridField.
    I set the OptionDataSource, DisplayField and the ValueField. When the ListGrid is shown some of the values are properly matched and the DisplayField value from the data source is displayed in the grid. However some of the values are not matched and the value of the ValueField is displayed.

    For this field I have an EditorType set to ComboBoxItem for which I also have OptionDataSource, DispayField and the ValueField defined and when I enter the edit mode for the row and the field, that is in 'display' mode not matched properly, ComboBox displays the DisplayField value just fine.

    When I had less entries in the table in the database for which OptionDataSource is made all the values were properly displayed. When the number of entries grew the problem started showing up.

    Code:
    		cbItem = new ComboBoxItem();
    		cbItem.setIcons(newIcon);
    		  cbItem.setOptionDataSource(clientFactory.getItemsDS());
    		cbItem.setValueField("itemid");
    		cbItem.setDisplayField("name");
    		cbItem.setAutoFetchData(true);
    		cbItem.setAllowEmptyValue(false);
    		cbItem.setCompleteOnTab(true);
    		cbItem.setHideEmptyPickList(true);
    ListGridField itemField = new ListGridField("itemid", "Item");		
    itemField.setEditorType(cbItem);
    		itemField.setOptionDataSource(clientFactory.getItemsDS());
    		itemField.setValueField("itemid");
    		itemField.setDisplayField("name");
    		itemField.setAutoFetchDisplayMap(true);
    I tried on the latest Chrome and FireFox and it's the same behavior.

    What do I need to set in order to match all the values properly?

    #2
    Hi mandjeo,

    your cbItem settings are only important when in edit mode. The issue is occurring only in view-mode, correct?

    Nevertheless: In 4.1p+, the call should be setEditorProperties() instead of setEditorType() according to the docs. I don't know if there is really a difference as it should be a synonym, but who knows.

    More important: See the docs for ListGridField.setOptionDataSource() which suggests another mode (join + displayField in .ds.xml) if the list to fetch is pretty big. For me it sounds like if this could be the reason for your issue ("When I had less entries in the table in the database for which OptionDataSource is made all the values were properly displayed.").

    Best regards,
    Blama

    Comment


      #3
      Hi Blama,

      Thank you for the reply.
      You are right, the problem for me is in the view mode, the ComboBoxItem seems to work fine but I just stated this to say that with the CB item it works fine while the ListGridItem it doesn't fetch properly even though the settings are practically the same.

      Originally posted by Blama View Post
      More important: See the docs for ListGridField.setOptionDataSource() which suggests another mode (join + displayField in .ds.xml) if the list to fetch is pretty big.
      I wrote my RestDataSource I am not using the Enterprise version data sources. I never had a problem with my data source when fetching data and so on.

      Do you have any advice that I can try to make this work without the enterprise features?

      Comment


        #4
        Hi mandjeo,

        I'd think that the suggested approach should also work if you use another datasource-type. Just make your RestDataSource provide the needed data as DataSourceField in your .ds.xml and point your itemid-field to this new field with a displayField-attribute.

        If this is not possible I can't help here as I don't use RestDataSources.

        Best regards,
        Blama

        Comment

        Working...
        X