Skip to Content

Odata service triggering twice

Hi Experts,

I am using a smart table feature in my ui5 application, And i am using setEntity() method to set the entity Set Property to a smart table from the controller, it is working fine but the Problem is oData Service call is triggering twice, So i need your help to fix this.

Please find the below ui5 code :

View.xml:

<smartTable:SmartTable id="smartTableId" useExportToExcel="true" tableType="ResponsiveTable" useVariantManagement="true" useTablePersonalisation="true" showTablePersonalisation="true" header="Line Items" showRowCount="true"
persistencyKey="details.smartTable" enableAutoBinding="true" class="sapUiResponsiveContentPadding" beforeRebindTable="onBeforeRebindTableExtension" requestAtLeastFields="ID,Name">
</smartTable:SmartTable>

Controller:

onInit:function()
{
var entity ="Results";
var oTable = this.getView().byId("smartTableId");
oTable.setEntitySet(entity);
oTable.rebindTable(true);
}

i am able to set the entitySet to the smart table but, it is triggering oData service twice.

Network Tab:

Please find the Results and count call triggering twice when i run the app .

Any suggestion would be a great help.

Thanks in advance,

Regards,

Pradeep

capre.png (101.3 kB)
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Feb 26 at 12:39 PM

    Hello,

    In your manifest,json modify your model setting with the count mode to Inline.

    Regards,

    Joseph

    Add comment
    10|10000 characters needed characters exceeded

  • Feb 23 at 08:21 AM

    hi Pradeep,

    Try using the entityset Property of the smart table control in the View and then you won't need to set it in the init method..

    It should resolve your issue

    Thanks,

    Vaibhav

    Add comment
    10|10000 characters needed characters exceeded

    • hi Pardeep,

      This is my view code :

      <mvc:View controllerName="orderconf.controller.InitialView" xmlns:core="sap.ui.core" xmlns:html="http://www.w3.org/1999/xhtml"
      xmlns:mvc="sap.ui.core.mvc" xmlns:smartFilterBar="sap.ui.comp.smartfilterbar" xmlns:smartTable="sap.ui.comp.smarttable"
      xmlns:app="http://schemas.sap.com/sapui5/extension/sap.ui.core.CustomData/1" displayBlock="true" xmlns="sap.m" xmlns:t="sap.ui.table">
      <smartFilterBar:SmartFilterBar id="smartFilterBar" entityType="OrderOperation" search="SearchEvt" persistencyKey="SmartFilter_Explored"
      basicSearchFieldName="" enableBasicSearch="false" beforeVariantSave="beforeVariantSave" afterVariantLoad="afterVariantLoad" >
      <smartFilterBar:controlConfiguration>
      </smartFilterBar:controlConfiguration>
      </smartFilterBar:SmartFilterBar>
      <Bar>
      <contentLeft>
      <Button id="DownloadPDFBtn" text="Download PDF" press="onPDFDownload"></Button>
      <Button id="EnterConfBtn" text="Enter Confirmation" press="onEnterConfirmation"></Button>
      </contentLeft>
      </Bar>
      <smartTable:SmartTable id="LineItemsSmartTable" smartFilterId="smartFilterBar" tableType="Table"
      useExportToExcel="true" useVariantManagement="false" useTablePersonalisation="false" showRowCount="true" header="Order Confirmation List"
      beforeRebindTable="beforeRebindTable" persistencyKey="SmartTableAnalytical_Explored" showFullScreenButton="true" enableAutoBinding="true" app:useSmartField="true">
      <smartTable:layoutData>
      <FlexItemData growFactor="1" baseSize="0%"/>
      </smartTable:layoutData>
      </smartTable:SmartTable>
      </mvc:View>