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

  • FilterBuilder widget - Datasource fields options populating blank

    I am using filter builder component of smartgwt. Everything works fine except the fields where values is a list of dropdown. The dropdown pouplates with lots of blank values.I am not able to find any hook like editorcustomizer etc.
    Can you please guide how can I show the data correctly and show the data according to criteria.

    FilterBuilder filterBuilder = new FilterBuilder();
    In ds.xml my field is defined as :
     <field name="myField" type="integer" foreignKey="OtherDS.primaryKeyId" displayField="myValue" title="Hand"/>
    PFB the image with blank options for this field :

    Click image for larger version

Name:	Capture.PNG
Views:	1
Size:	9.6 KB
ID:	258187

    Is it possible to send a criteria to show filtered value here? Also please suggest why the options are showing as empty. I can't see anything on smartgwt console. No fetch calls.

    Thanks in advance.

  • #2
    This would normally initiate a fetch, and the fact that the drop-down is populated with blanks very strongly suggests that a fetch was initiated and some data received, so your claim that no fetch occurred is probably not accurate.

    Instead, the response was probably broken in some way: no data for the configured displayField ("myValue") in the related records. The same thing would happen for a DynamicForm or ListGrid, which probably means that you've added additional properties or overrides to make this work in other components. We would recommend instead making the definition the DataSource uses actually work.

    You can customize the FormItem used to pick the value for filtering via getValueFieldProperties().


    • #3
      Thanks Isomorphic ,
      I can see the intermittent fetch calls in console with the data that should come but on UI the list is big and empty. If I select any records it shows some ID. I tried getValueFieldProperties() as suggested by you like below.

        filterBuilder = new FilterBuilder() {
                  public FormItem getValueFieldProperties(FieldType type, String fieldName, OperatorId operatorId, ValueItemType itemType, String fieldType) {
                          SelectItem item = new SelectItem();
                          Map<String,String> valueMap = new HashMap<>();
                          valueMap.put("1", "val 1");
                          valueMap.put("2", "val2 2");
                          return item;
                      return super.getValueFieldProperties(type, fieldName, operatorId, itemType, fieldType);
      But it still not working.
      I guess this is about displayField because on selection any option I get the ID on screen. I tried to set displayField on primaryKey field but still its not showing data on screen.
      Can you please tell if I am doing it wrong. Also I want to pass criteria in these fields fetch calls.

      Thanks in advance.
      Last edited by preeti_kanyal; 17th Jun 2019, 00:02.


      • #4
        You are able to provide any SelectItem properties you want, so you can pass optionCriteria or provide a pickListCriteriaFunction, or setPickListFields if there’s some other field you wish to use rather than the PK.

        Setting the displayFirld also works as usual, so something is likely wrong in your code. There are no obvious errors in the small amount of code you’ve shown, we would need complete, ready-to-run code in order to pin down the error.