Announcement

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

    Page size with a RestDataSource and FilterBuilder

    Hi all!

    I'm trying to use the FilterBuilder with a RestDataSource, but in my initial experiments I couldn't make the FilterBuilder send to server a XML with the <startRow></startRow>, <endRow></endRow> and <totalRows></totalRows> elements filled. I searched the API and the only place I saw to set was the ListGrid. My mistake? How can I set up the DataSource and the FilterBuilder to send the page size?

    My ui set up code:
    Code:
    final PostBasedRestDataSource planoDS = new PostBasedRestDataSource();
    planoDS.setID("planoDS");
    planoDS.setDataURL(GWT.getHostPageBaseURL() + "rs/datasource");
    
    final PostBasedRestDataSource filterDS = new PostBasedRestDataSource();
    filterDS.setID("filterDS");
    filterDS.setDataURL(GWT.getHostPageBaseURL() + "rs/filter");
    
    final FilterBuilder filterBuilder = new FilterBuilder();
    filterBuilder.setFieldDataSource(filterDS);
    filterBuilder.setDataSource(planoDS);        
    
    final ListGrid grid = new ListGrid();
    grid.setWidth100();
    grid.setHeight100();
    grid.setAutoFetchData(true);
    grid.setDataPageSize(50);
    grid.setSortField(0);
    grid.setDataSource(planoDS);
    grid.setFetchDelay(500);

    My PostBasedRestDataSource:
    Code:
    public class PostBasedRestDataSource extends RestDataSource {
    
        public PostBasedRestDataSource() {
            OperationBinding fetch = new OperationBinding();
            fetch.setOperationType(DSOperationType.FETCH);
            fetch.setDataProtocol(DSProtocol.POSTMESSAGE);
            OperationBinding add = new OperationBinding();
            add.setOperationType(DSOperationType.ADD);
            add.setDataProtocol(DSProtocol.POSTMESSAGE);
            OperationBinding update = new OperationBinding();
            update.setOperationType(DSOperationType.UPDATE);
            update.setDataProtocol(DSProtocol.POSTMESSAGE);
            OperationBinding remove = new OperationBinding();
            remove.setOperationType(DSOperationType.REMOVE);
            remove.setDataProtocol(DSProtocol.POSTMESSAGE);
            this.setOperationBindings(fetch, add, update, remove);
        }
    }
    The initial request:

    Code:
    <request>
      <data>
      <planoDS/>
      </data>
      <dataSource>planoDS</dataSource>
      <operationType>fetch</operationType>
      <startRow>0</startRow>
      <endRow>50</endRow>
      <sortBy>id</sortBy>
      <textMatchStyle>substring</textMatchStyle>
      <componentId>isc_OID_5</componentId>
      <oldValues></oldValues>
     </request>
    The filter request. Note the <startRow> element missing:

    Code:
    <request>
      <data>
      <planoDS constructor="AdvancedCriteria">
        <operator>and</operator>
      </planoDS>
      </data>
      <dataSource>planoDS</dataSource>
      <operationType>fetch</operationType>
      <textMatchStyle>substring</textMatchStyle>  
      <oldValues></oldValues>
    </request>

    Thanks in advance!

    #2
    Please, anyone already have used the FilterBuilder with a RestDataSource?

    Sorry to insist, but is there anyone who already used the FilterBuilder, with paging and the RestDataSource?

    Thanks!

    Comment


      #3
      Sorry, my bad!

      Good morning, sorry, my fault, in my code I had wrote:

      Code:
      filter.filterData(filterBuilder.getCriteria());
      But the right is:

      Code:
      grid.filterData(filterBuilder.getCriteria());
      Sorry, and thanks!

      Comment

      Working...
      X