Announcement

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

    RPC ListGrid

    Hi guys,

    I'm trying since the beginning of the month to make a listgrid working with RPC calls, without success.
    Here is what I exactly want to do :
    - I've some search criterias at the top of the page and a submit button. When submitting the form, I wish to update the Listgrid threw a RPC call
    - I've activated the listgrid's filter bar. When updating the filter, I wish the same RPC call to be made.

    By now, I use a datasource parsing XML but it's not enough (error handling) for the case I'm working on. I need the onSuccess and onFailure RPC methods.

    Is there a way (and what is it?) to work?

    #2
    What do you mean by "RPC calls"? GWT-RPC? We don't recommend GWT-RPC (see the FAQ) as it's overcomplicated and does far less than the Pro product you already have.

    If you mean "RPC" in the sense of our RPCManager, the Pro/EE Showcase has many examples of this type of interaction - follow any of them.

    Comment


      #3
      Yes I intended to use the GWT-RPC.
      But, ok to use the Datasource, I'm writing some test-example to show you exactly what I try to do.

      Comment


        #4
        Okay, here is my example

        The XML url in the datasource is a dynamic XML generated by Spring and have the following look :
        Code:
        <response>
        <status>0</status>
        <startRow>0</startRow>
        <endRow>2</endRow>
        <totalRows>1347</totalRows>
        −
        <data>
        −
        <transportResult>
        <ituCode>404007801</ituCode>
        <lastStatus>30</lastStatus>
        <terminals>
        						578<br/>
        						558<br/>
        						558
        					</terminals>
        <fullOrEmpty>1</fullOrEmpty>
        <weights>
        						5750<br/>
        						2050
        					</weights>
        <statusDate>Mon Mar 02 11:40:39 CET 2009</statusDate>
        <departureDate>Mon Mar 02 11:40:39 CET 2009</departureDate>
        −
        <actors>
        
        						0042020<br/>
        						0042020<br/>
        						0042023
        					
        </actors>
        <refNumbers>
        						KEINE<br/>
        						5785600009
        					</refNumbers>
        −
        <controlNumbers>
        
        						50276<br/>
        						50276<br/>
        						318049541010
        					
        </controlNumbers>
        </transportResult>
        −
        <transportResult>
        <ituCode>404007942</ituCode>
        <lastStatus>50</lastStatus>
        <terminals>
        						578<br/>
        						520<br/>
        						520
        					</terminals>
        <fullOrEmpty>1</fullOrEmpty>
        <weights>
        						11758<br/>
        						2050
        					</weights>
        <statusDate>Tue Mar 03 09:34:00 CET 2009</statusDate>
        <departureDate>Mon Mar 02 11:40:28 CET 2009</departureDate>
        −
        <actors>
        
        						0042020<br/>
        						0042120<br/>
        						0042023
        					
        </actors>
        <refNumbers>
        						KEINE<br/>
        						5785600051
        					</refNumbers>
        −
        <controlNumbers>
        
        						50276<br/>
        						50276<br/>
        						318049543461
        					
        </controlNumbers>
        </transportResult>
        </data>
        </response>
        My first question is (resolved) : once the search is made, I only see the 2 results in my listgrid. No pagination is made at all, why?

        A second question is : once the search is made, the filter field is not updated imediately. I have to click on the filter's field to update it. How could I update it directly?
        Attached Files
        Last edited by romain.vdk; 3 Aug 2010, 23:38.

        Comment


          #5
          Ok, for the point 1 I found what was wrong ...
          The correct code for the pagination is the following :
          Code:
          searchItu.addClickHandler(new ClickHandler() {
          	@Override
          	public void onClick(ClickEvent arg0) {
          		Criteria c = new Criteria();
          		c.addCriteria("ituCode",inputItu.getText());
          		listGrid.invalidateCache();
          		listGrid.fetchData(c, new DSCallback() {
          			public void execute(DSResponse response, Object rawData, DSRequest request) {
          				// Do not set the data here!
          				// listGrid.setData(response.getData());
          			}
          		});
          	}
          });

          Comment


            #6
            What exactly do you mean the filter field not updated? You mean it doesn't populate with the pre-defined criteria you have? Anyway can always directly change it with setFilterEditorCriteria().

            Comment


              #7
              I think my filter is properly populated, but I have to click on the filter to "update" the data.
              I will explain it in an other way: I put the data I want in an inputBox. Threw a button, I submit the search and the datasource is updated. The data in the listgrid are properly shown, but at that time nothing is displayed in the filter. When I want to edit the empty filter box, I click on it and tada, my criteria appears ...
              What I want is that the criteria appears in the filter when I click on the button. I tried yous solution, but it changed nothing ...

              Comment


                #8
                Well setFilterEditorCriteria() will populate the filter editor with the criteria given the criteria is correct. Are you trying a really simple criteria as a test?

                Comment


                  #9
                  Yes I am. I'll show you what I'm using :

                  Code:
                  final ListGrid listGrid = new ListGrid();
                  ListGridField ituCode = new ListGridField("ituCode","Itu Code");
                  ituCode.setFrozen(true);
                  ituCode.setWidth(120);
                  /* some code to initialize other fields */
                  listGrid.setFields(ituCode,lastStatus,terminals,fullOrEmpty,weights,statusDate,departureDate,actors,refNumbers,controlNumbers);
                  
                  searchItu.addClickHandler(new ClickHandler() {
                  	@Override
                  	public void onClick(ClickEvent arg0) {
                  		Criteria c = new Criteria();
                  		c.addCriteria("ituCode",inputItu.getText());
                  		listGrid.setFilterEditorCriteria(c);
                  		listGrid.invalidateCache();
                  		listGrid.fetchData(c,dsaction);
                  	}
                  });
                  So you can see that my criteria is very simple, but sadly using your method just changes nothing ...

                  Comment

                  Working...
                  X