Announcement

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

    Dependent selects in ListGrid filter editor

    Hello,

    We have a ListGrid with two columns and a filter editor. The filter editor should display a dropdown for both columns but second dropdown depends on the first one.

    I have seen a showcase example (Dependent selects) where a ChangeHandler is used on the first SelectItem to set the values of the second SelectItem.

    The question is: how can I add that ChangeHandler to the filter editor? I can't find the way to get the items of that filter. (Or is there another solution for my requirement?).

    I tried this simple example (without dropdowns, just to try the handlers) but it doesn't work; I suppose it's wrong because I use the ListGridFields and not the filter fields.
    Code:
    ListGrid grid = new ListGrid();
    grid.setWidth(500);
    grid.setHeight(200);
    
    ListGridField keyField = new ListGridField("key");
    keyField.setRequired(true);
    keyField.addChangedHandler(new ChangedHandler() {
    	@Override
    	public void onChanged(ChangedEvent event) {
    		Log.debug("not called when filter is changed");
    	}
    });
    keyField.addChangeHandler(new ChangeHandler() {
    	@Override
    	public void onChange(ChangeEvent event) {
    		Log.debug("not called when filter changes");
    	}
    });
    
    ListGridField valueField = new ListGridField("value");
    valueField.setRequired(true);
    
    grid.setFields(keyField, valueField);
    grid.setShowFilterEditor(true);
    grid.setCanEdit(true);
    
    grid.draw();
    Thank you!

    Ferran
    Last edited by ferranmc; 29th Dec 2011, 01:42.

    #2
    I forgot to say I'm using:

    SmartGWT 3.0
    GWT 2.4.0
    Internet Explorer 8

    Comment


      #3
      Please let me know whether this can be done or I should build my own filter.
      Thanks!

      Comment


        #4
        Please I just need to know if there is a way to configure the grid filter.
        Thanks! :)

        Comment


          #5
          Was this ever resolved? I am going to attempt the same thing. Is there any sample code I could look at?

          Comment


            #6
            Nothing to resolve, looks like this user didn't notice listGridField.setFilterEditorType() and setFilterEditorProperties(), both of which allow you to add a Changed handler.

            Comment

            Working...
            X