Announcement

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

    Advanced Criteria error: AdvancedCriteria(String, OperatorId, String) is undefined

    Hello, Im attempting to use AdvancedCriteria in my datasource searches.
    I need access to the OperatorId.Or OperatorId because I need to be able to do a criteria search that will return multiple records that might not show
    up with a normal fetchData(Criteria crit).
    I found that with fetchData(Criteria) you cant stack your criteria (Like looking for multiple "FirstName" fields with different names.

    this led me to AdvancedCriteria. Im attempting to use it with filterbuilder.

    Heres my code

    ListGrid lGrid = new ListGrid();
    MemberData memberData = new MemberData();

    ListGridField listgridrecordidField = new ListGridField("MemberId", "ID");
    ListGridField firstNameField = new ListGridField("FirstName", "First Name");
    ListGridField lastNameField = new ListGridField("LastName", "Last Name");
    lGrid.setFields(listgridrecordidField, lastNameField, firstNameField);
    lGrid.setDataSource(memberData.getNewMemberData());

    FilterBuilder filterBuilder = new FilterBuilder();

    AdvancedCriteria aCriteria1 = new AdvancedCriteria("FirstName", OperatorId.IS_NULL);
    filterBuilder.setCriteria(aCriteria1);
    filterBuilder.setDataSource(lGrid.getDataSource());
    lGrid.filterData()
    I went with the OperatorId.IS_NULL route instead of my intended OperatorId.Or since none of my values are NULL and I knew this should allow AdvancedCriteria to work as its the simplest example by not returning anything if the filterbuilder was working.

    I found that when I run fetchData() or filterData() (after setting up the
    advancedcriteria and adding it to the filterbuilder and setting the filterbuilders datasource to be the datasource attached to the listgrid) my listgrid shows all the data from the datasource, and not an empty result since none of my listgridrecords have a null "FirstName".


    My code in eclipse doesnt show AdvancedCriteria to have any errors in the signature, as it did before I got SmartGwt 2.1.

    This is the correct way to use AdvancedCriteria, correct? With filterbuilder and then setting the attached datasource to be the datasource for the filterbuilder and then just doing a fetchDate() or filterData()?
    If im supposed to use FilterBuilder in a different way can someonehelp me out?

    Id really love to get this going, and could use some help.

    Sincerely,

    thebravedave
    Last edited by thebravedave; 12 Mar 2010, 21:22.

    #2
    You're intended to pass the criteria from the FilterBuilder to the ListGrid. They have a common DataSource, but not a common cached set of data - each component needs to be able to have a separate cache of data or you would not be able to work with large datasets where all data cannot be loaded up front. See also the docs for ResultSet.

    Comment


      #3
      Same problem..

      Hi Isomorphic..

      Allow me to ask almost the same question than was made before here.
      I'm using GWT2.0.3/SmartGWT2.2.

      This is my code:
      Code:
      DataSource ds = EstudianteDS.getInstancia();
              final FilterBuilder filterBuilder = new FilterBuilder();
              filterBuilder.setDataSource(ds);
              
              final ListGrid grid = new ListGrid();
              grid.setWidth(400);
              grid.setHeight(100);
              grid.setDataSource(ds);
              grid.setAutoFetchData(true);
      
              ListGridField nombre = new ListGridField("nombre");
              ListGridField apellidos = new ListGridField("apellidos");
      
              grid.setFields(nombre, apellidos);
      
              grid.setDataFetchMode(FetchMode.BASIC);
              //grid.setDataPageSize(20);
              grid.setCanEdit(true);
      
              grid.setShowFilterEditor(true);
              grid.setFilterOnKeypress(true);
              grid.setAlternateRecordStyles(true);
              grid.setTop(50);
              grid.setAlternateRecordStyles(Boolean.TRUE);
      
               final VStack vstack = new VStack(20);
              grid.setLeft(20);
      
              final IButton filterButton = new IButton("Filter NOW!");
              
              vstack.addMember(filterBuilder);
              vstack.addMember(filterButton);
              vstack.addMember(grid);
      
              
      
              filterButton.addClickHandler(new ClickHandler() {
      
                  public void onClick(ClickEvent event) {
      
                      grid.fetchData(filterBuilder.getCriteria());
      
                  }
              });
      
      //I saw Isomorphic speaking about ResultSet and tried this, but did't work        
      //ResultSet res = new ResultSet(ds);
      //        grid.setDataSource(res.getDataSource());
      //        filterBuilder.setDataSource(res.getDataSource());
      
              HStack hstack = new HStack(20);
              
              hstack.addMember(current);
              hstack.addMember(next);
              
              vstack.addMember(hstack);
              vstack.draw();

      Sometimes using the FilterBuilder it works, but when I increment the number of conditios, it throws an error like this:

      Code:
      00:03:37.274 [ERROR] 08:53:56.894:MUP2:WARN:ListGrid:isc_ListGrid_0:ListGrid with filterEditor - unable to display advanced criteria in filter editor
      com.smartgwt.client.core.JsObject$SGWT_WARN: 08:53:56.894:MUP2:WARN:ListGrid:isc_ListGrid_0:ListGrid with filterEditor - unable to display advanced criteria in filter editor 	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) 	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) 	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) 	at java.lang.reflect.Constructor.newInstance(Constructor.java:513) 	at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:105) 	at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71) 	at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:157) 	at com.google.gwt.dev.shell.BrowserChannel.reactToMessagesWhileWaitingForReturn(BrowserChannel.java:1713) 	at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:165) 	at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:120) 	at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:507) 	at com.google.gwt.dev.shell.ModuleSpace.invokeNativeVoid(ModuleSpace.java:284) 	at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeVoid(JavaScriptHost.java:107) 	at com.smartgwt.client.widgets.grid.ListGrid.fetchData(ListGrid.java) 	at gtm.gob.client.TutorialEntryPoint$2.onClick(TutorialEntryPoint.java:108) 	at com.smartgwt.client.widgets.events.ClickEvent.dispatch(ClickEvent.java:96) 	at com.smartgwt.client.widgets.events.ClickEvent.dispatch(ClickEvent.java:1) 	at com.google.gwt.event.shared.HandlerManager$HandlerRegistry.fireEvent(HandlerManager.java:65) 	at com.google.gwt.event.shared.HandlerManager$HandlerRegistry.access$1(HandlerManager.java:53) 	at com.google.gwt.event.shared.HandlerManager.fireEvent(HandlerManager.java:178) 	at com.smartgwt.client.widgets.BaseWidget.fireEvent(BaseWidget.java:67) 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) 	at java.lang.reflect.Method.invoke(Method.java:597) 	at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103) 	at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71) 	at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:157) 	at com.google.gwt.dev.shell.BrowserChannel.reactToMessagesWhileWaitingForReturn(BrowserChannel.java:1713) 	at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:165) 	at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:120) 	at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:507) 	at com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:264) 	at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeObject(JavaScriptHost.java:91) 	at com.google.gwt.core.client.impl.Impl.apply(Impl.java) 	at com.google.gwt.core.client.impl.Impl.entry0(Impl.java:188) 	at sun.reflect.GeneratedMethodAccessor26.invoke(Unknown Source) 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) 	at java.lang.reflect.Method.invoke(Method.java:597) 	at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103) 	at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71) 	at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:157) 	at com.google.gwt.dev.shell.BrowserChannel.reactToMessages(BrowserChannel.java:1668) 	at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:401) 	at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:222) 	at java.lang.Thread.run(Thread.java:619)
      and this error too:
      Code:
      00:03:37.324 [ERROR] 08:53:56.945:MUP2:WARN:RPCManager:Error performing rpcRequest: error: FAILURE, response: {clientContext: Obj, status: -1, context: undef, startRow: 0, endRow: 0, totalRows: 0}
      com.smartgwt.client.core.JsObject$SGWT_WARN: 08:53:56.945:MUP2:WARN:RPCManager:Error performing rpcRequest: error: FAILURE, response: {clientContext: Obj,
      status: -1,
      context: undef,
      startRow: 0,
      endRow: 0,
      totalRows: 0} 	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) 	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) 	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) 	at java.lang.reflect.Constructor.newInstance(Constructor.java:513) 	at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:105) 	at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71) 	at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:157) 	at com.google.gwt.dev.shell.BrowserChannel.reactToMessagesWhileWaitingForReturn(BrowserChannel.java:1713) 	at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:165) 	at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:120) 	at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:507) 	at com.google.gwt.dev.shell.ModuleSpace.invokeNativeVoid(ModuleSpace.java:284) 	at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeVoid(JavaScriptHost.java:107) 	at com.smartgwt.client.data.DataSource.processResponse(DataSource.java) 	at gtm.gob.client.lib.GenericGwtRpcDataSource$1.onFailure(GenericGwtRpcDataSource.java:152) 	at gtm.gob.client.remote.TutorialService_Proxy.fetch(TutorialService_Proxy.java:63) 	at gtm.gob.client.lib.GenericGwtRpcDataSource.executeFetch(GenericGwtRpcDataSource.java:142) 	at gtm.gob.client.lib.GwtRpcDataSource.transformRequest(GwtRpcDataSource.java:73) 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) 	at java.lang.reflect.Method.invoke(Method.java:597) 	at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103) 	at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71) 	at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:157) 	at com.google.gwt.dev.shell.BrowserChannel.reactToMessagesWhileWaitingForReturn(BrowserChannel.java:1713) 	at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:165) 	at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:120) 	at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:507) 	at com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:264) 	at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeObject(JavaScriptHost.java:91) 	at com.google.gwt.core.client.impl.Impl.apply(Impl.java) 	at com.google.gwt.core.client.impl.Impl.entry0(Impl.java:188) 	at sun.reflect.GeneratedMethodAccessor26.invoke(Unknown Source) 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) 	at java.lang.reflect.Method.invoke(Method.java:597) 	at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103) 	at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71) 	at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:157) 	at com.google.gwt.dev.shell.BrowserChannel.reactToMessagesWhileWaitingForReturn(BrowserChannel.java:1713) 	at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:165) 	at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:120) 	at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:507) 	at com.google.gwt.dev.shell.ModuleSpace.invokeNativeVoid(ModuleSpace.java:284) 	at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeVoid(JavaScriptHost.java:107) 	at com.smartgwt.client.widgets.grid.ListGrid.fetchData(ListGrid.java) 	at gtm.gob.client.TutorialEntryPoint$2.onClick(TutorialEntryPoint.java:108) 	at com.smartgwt.client.widgets.events.ClickEvent.dispatch(ClickEvent.java:96) 	at com.smartgwt.client.widgets.events.ClickEvent.dispatch(ClickEvent.java:1) 	at com.google.gwt.event.shared.HandlerManager$HandlerRegistry.fireEvent(HandlerManager.java:65) 	at com.google.gwt.event.shared.HandlerManager$HandlerRegistry.access$1(HandlerManager.java:53) 	at com.google.gwt.event.shared.HandlerManager.fireEvent(HandlerManager.java:178) 	at com.smartgwt.client.widgets.BaseWidget.fireEvent(BaseWidget.java:67) 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) 	at java.lang.reflect.Method.invoke(Method.java:597) 	at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103) 	at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71) 	at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:157) 	at com.google.gwt.dev.shell.BrowserChannel.reactToMessagesWhileWaitingForReturn(BrowserChannel.java:1713) 	at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:165) 	at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:120) 	at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:507) 	at com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:264) 	at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeObject(JavaScriptHost.java:91) 	at com.google.gwt.core.client.impl.Impl.apply(Impl.java) 	at com.google.gwt.core.client.impl.Impl.entry0(Impl.java:188) 	at sun.reflect.GeneratedMethodAccessor26.invoke(Unknown Source) 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) 	at java.lang.reflect.Method.invoke(Method.java:597) 	at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103) 	at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71) 	at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:157) 	at com.google.gwt.dev.shell.BrowserChannel.reactToMessages(BrowserChannel.java:1668) 	at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:401) 	at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:222) 	at java.lang.Thread.run(Thread.java:619)
      Isomorphic, the problem is I don't really undestand how you said abot ResultSet and both widgets' cache handling.

      Please help me..and thanks a lot.
      Dariel

      Comment

      Working...
      X