Announcement

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

    Question about FilterDataHandler

    I have been trying out the new FilterDataHandler, but it doesn't seem to work as I expected. What I expected to happen was that if you type something in the filtereditor and some kind of filter happens (no matter if it is clientside or serverside) an event happens. However it does not seem to trigger with me. Is this a bug or is it supposed to do something else?

    I am using SmartClient Version: SC_SNAPSHOT-2010-11-10/PowerEdition Deployment (built 2010-11-10) with GWT 2.0.4 on Firefox 3.6.12


    Code:
    package test.client;
    
    import com.google.gwt.core.client.EntryPoint;
    import com.smartgwt.client.data.DataSource;
    import com.smartgwt.client.widgets.events.FilterDataEvent;
    import com.smartgwt.client.widgets.events.FilterDataHandler;
    import com.smartgwt.client.widgets.grid.ListGrid;
    
    public class FilterDataChanged implements EntryPoint {
    	
    	public void onModuleLoad() {
    		final ListGrid listGrid = new ListGrid();
    		listGrid.setDataSource(DataSource.get("contents"));
    		listGrid.fetchData();
    		listGrid.setShowFilterEditor(true);
    		listGrid.setWidth100();
    		listGrid.addFilterDataHandler(new FilterDataHandler() {
    			@Override
    			public void onFilterData(FilterDataEvent event) {
    				System.err.println("Filter Data is triggered");
    			}
    		});
    		listGrid.draw();
    	}
    }
    Code:
    <DataSource ID="contents" serverType="sql" tableName="content">
    	<fields>
    		<field primaryKey="true" type="sequence" name="cntn_pk" hidden="true" export="false"></field>
    		<field type="datetime" name="cntn_createdOn" canEdit="false" canFilter="true" title="" detail="true" showInGrid="true" export="true"></field>
    		<field type="text" length="45" name="cntn_id" required="true" exportable="true" export="true"></field>
    		<field title="bar" type="text" length="45" name="cntn_barCode" showInGrid="true" canEdit="false" export="true"></field>
    		<field type="integer" name="cntn_fk_location" hidden="false"></field>
    		<field title="quantity" type="float" name="cntn_quantity" export="true"></field>
    		<field title="unit" type="text" length="45" name="cntn_unit" export="true" ></field>
    	</fields>
    </DataSource>

    #2
    It's called when filtering is initiated from the FilterEditor. For other kinds of filtering (including programattic calls) consider DataArrived.

    Comment


      #3
      Ok, this was what i wanted, but it doesn't work here

      Comment


        #4
        Then please indicate exactly what set of clicks and/or typing is required to get it to misbehave in your sample.

        Comment


          #5
          Just clicking in a field of the filter editor, entering some value, and then pressing enter to filter, will not trigger it here. Neither will just typing something when setFilterOnKeyPress() is set to true. After trying on some different fields with different types. it actually never seems to trigger here

          Comment


            #6
            Hi RubenS

            We've reworked this area a little. We've replaced the listGrid.addFilterDataHandler() API with a new API listGrid.addFilterEditorSubmitHandler().

            We've tested the new filterEditorSubmit functionality internally and everything seems to be working as it should. The change will show up in our next nightly build. Please give it a try and let us know if you run into any issues with it!

            Comment


              #7
              Ok, this works fine now. Thanks for the support :)

              Comment


                #8
                Originally posted by RubenS
                Ok, this works fine now. Thanks for the support :)
                In smartGWT 2.2 LPGL version, looks like no such API provided?

                Comment

                Working...
                X