Search code examples
odatasapui5

Table 'Filter' sending 2 oData requests, with 2 different paging queries


I have a simple sap.m.Table, which is bound to an entityset. There is a searchfield which when used will do a simple filter on the binding and return the results. It all works fine but for some reason it sends 2 oData requests, both with different pagination properties, and I've no idea why??

XML:

<Table id="tabJobs" items="{/JobSet}" beforeOpenContextMenu="onBeforeOpenContextMenu" alternateRowColors="true" busy="{config>/busy}" busyIndicatorDelay="0" sticky="HeaderToolbar,ColumnHeaders">
    <headerToolbar>
        <Toolbar>
            <SearchField id="sfHeader" width="20%" placeholder="Search..." search=".onSearchJobs" showRefreshButton="true" value="{config>/searchField}"/>
        </Toolbar>
    </headerToolbar>
    ...
 </Table>

Controller:

onSearchJobs: function(oEvent) {
  var oFilter = [];
            
  oFilter.push(new Filter("SearchField", FilterOperator.EQ, oEvent.getSource().getValue()));
            
  this.byId("tabJobs").getBinding("items").filter(oFilter);
}

Manifest:

"": {
    "dataSource": "projects",
    "preload": false,
    "settings": {
        "defaultCountMode": "Inline",
        "defaultBindingMode": "TwoWay",
        "refreshAfterChange": true,
        "defaultUpdateMethod": "MERGE",
        "useBatch": true,
        "defaultOperationMode": "Server"
    }
},

oData Calls:

1st one: GET JobSet?$skip=0&$top=100&$filter=SearchField eq 'test'&$inlinecount=allpages
2nd one: GET JobSet?$skip=2&$top=98&$filter=SearchField eq 'test'&$inlinecount=allpages

Solution

  • So the issue is not UI5 related, but backend (ECC). The backend dev implemented $skiptoken, seemingly incorrectly, which results in the frontend sending a second call:

    lv_handle = io_tech_request_context->get_skiptoken( ).
    ...
    es_response_context-skiptoken = CONV #( lv_handle ).