Announcement

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

    #16
    Hi,

    Just to continue on same example - I tried to use same combo box in a same fashion with list grid cell editor but unfortunetly it doesn't call getPickListFilterCriteria() method? Is there any trick here too?
    Also unlike forms listGrid.getFields is empty in data bound grid. Although again fields are available in associated data source so is there any process for list grids to override there cell editors like we did for forms?

    Thanks,

    Comment


      #17
      Hey! I understood about the behaviour of listgrid. We don't override the Editor Type directly but we override the ListGrid fiels which may contain it's own editor type. Below is the test code and editor is showing up but again problem is getPickListFilterCriteria() is not being invoked? Am i missing something here?

      ArrayList<ListGridField> overriddenListGridFields = new ArrayList<ListGridField>();
      for(DataSourceField dataSourceField : listGrid.getDataSource().getFields()) {
      String foreignKey = dataSourceField.getAttribute("foreignKey");
      if(foreignKey != null){
      ListGridField listGridField = new ListGridField(dataSourceField.getName());
      final ComboBoxItem employeeComboBoxItem = new ComboBoxItem(){
      @Override protected Criteria getPickListFilterCriteria() {
      GWT.log("Called getPickListFilterCriteria()");
      return super.getPickListFilterCriteria();
      }
      };
      employeeComboBoxItem.setPickListFields(getPickListFields());
      listGridField.setEditorType(employeeComboBoxItem);
      overriddenListGridFields.add(listGridField);
      }
      }
      ListGridField[] overriddenListGridFieldArr = new ListGridField[overriddenListGridFields.size()];
      listGrid.setFields(overriddenListGridFields.toArray(overriddenListGridFieldArr));

      Comment


        #18
        Since there's no real "this" or "super" when it comes to setting the editor "type" to a FormItem instance that really represents the editor "properties", overriding of the getPickListFilterCriteria() method of ComboBoxItem is not applicable. Instead to accomplish this you need to use the alternate ComboBoxItem / SelectItem .setPickListFilterCriteriaFunction(..) API's on the editorType instance.

        The Grid Dependent Selects showcase sample has an example usage of this : http://www.smartclient.com/smartgwt/...t_selects_grid

        Comment


          #19
          Thanks you.

          Comment

          Working...
          X