Announcement

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

    Force refresh of the Combobox list of values

    Hi Isomorphic,

    I have a DynamicForm linked to a Listgrid. The Listgrid acts as a record selector, so that in the form you can edit the details of the record selected in the Listgrid.

    One of the fields of the form is a Combobox, and the available options (which are dynamic and have to be retrieved from the server) depend on what record is being edited. Hence, each time the selection is updated in the Listgrid, the set of available values in the Combobox should be refreshed accordingly.

    The approach that I have used is the following: I am using an optionDataSource to retrieve the Combobox available values. This optionDataSource has an inner attribute that marks the PK of the currently selected record. This attribute will be sent to the server in the fetchData call (inserted throught the transformRequest method). The problem I'm facing is that althought this attribute is updated each time the Listgrid selection changes (in the listgrid.selectionUpdated method), Smart Client does not call the fetchData in order to refresh the available values. I've seen that Smart Client does call the fetchData method, but it seems that the aim of this call is to update the value of the displayField, but not the list of available values.

    What is the best approach to solve this problem? How can I force Smart Client to refresh the list of available values?

    Smart client version: v8.3p_2013-05-28 (2013-05-28)
    Browser: Google Chrome 27.0.1453.94 m

    #2
    If you haven't already, look over the docs for comboBoxItem filtering.

    The comboBoxItem should already be re-filtering its results when the user shows the pickList, applying the specified picklistFilterCriteriaFunction() if one exists.
    However by default filtering will be applied to data on the client side if the client believes records have been cached. If you're modifying criteria as part of transformRequest, or similar, you may need to disable client-side filtering - see setUseClientFiltering() (and also ensure that local filtering is disabled).

    If this doesn't allow you to resolve the problems, it might make sense to show us a test case so we can clearly see what you're trying to achieve

    Regards
    Isomorphic Software

    Comment


      #3
      Hi,
      I see that the links you have provided for localFiltering and useClientFiltering work with the server part of SmartClient. But I am using SmartClient only on the client-side.
      I could find localFiltering in the ComboboxItem Javascript class, but I could not find the useClientFiltering option. Is there an equivalent for this on the client-side?

      Thanks

      Comment


        #4
        Sorry for the confusion here - there are 2 things:
        Firstly - we actually linked to SmartGWT docs rather than SmartClient docs.

        Here are the docs for SmartClient:

        Combobox Filtering overview

        getPickListFilterCriteria() function (Override for custom filter behavior).

        ComboBoxItem.filterLocally - set to false to ensure every time the criteria changes, the picklist requests fresh data from the server.

        On useClientFiltering - this is available as comboBoxItem.useClientFiltering (a boolean) in the 9.0 branch - however since you're using 8.3, you'll need to explicitly customize the drop down picklist of results (a ListGrid subclass) via comboBoxItem.pickListProperties, and on that object specify dataProperties to customize the ResultSet - setting useClientFiltering to false there.
        Something like this:
        Code:
        isc.DynamicForm.create({
           items:[
            {name:"combo", editorType:"ComboBoxItem",
             pickListProperties:{
               dataProperties:{useClientFiltering:false}
             },
            ... other props
           ]
        });
        Please let us know if you can't get things working

        Regards
        Isomorphic Software

        Comment

        Working...
        X