on 2023 Aug 14 4:29 PM
Dear fellow ui5 developers / experts,
i have to display two smart tables with two different data sources. (default odata model and named odata model eg oTempModel)
smart table with default model works absolutely fine.
smart table with named model always doesnt work. tried with numerous possibilities but could not able to succeed.
we are on sap ui5 1.71.53 version.
can any one give some valid pointers or solution if they made it work ?
Thanks in Advance
Siddarth
The smart control library (sap.ui.comp) only supports "a default model (named undefined)" (see the documentation here), that's why your smart table with named model does not work.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Let me know if still have any doubt or issue i am already doing same in one view using multiple service for each different icon tab
in your Controller add in your onInit method
//either create here or take model defined in menifest
var oDataModel = new ODataModel(sServiceUrl, true);
this.getView().setModel(oDataModel, "odataModel");
in View
<smartTable:SmartTable id="idSmartTableEditUser" entitySet="results" tableBindingPath="odataModel>/EntitySet" initiallyVisibleFields="Username" showTablePersonalisation="false" >
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
let us in manifest you declared with name otherModel then in view you bind
otherModel >/EntityName
That also work for me
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@siddarth.kabde is your other smart table on view or in any fragment which you want to bind non default model
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
yoursecondmsarttable.setModel(oTempModel)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Jun Wu,
Thanks for your effort to help me. i tried that.
please find screenshots. please correct me if something is wrong here.
odata model - loaded in manifest.json file.
"oModelSummary": {
"type": "sap.ui.model.odata.v2.ODataModel",
"settings": {
"defaultOperationMode": "Server",
"defaultBindingMode": "TwoWay",
"defaultCountMode": "Request"
},
"dataSource": "Z*****_SRV",
"preload": true
}
Smart Table :
<smartTable:SmartTable id="idProfitSmartTable2" entitySet="Z***Results" smartFilterId="smartFilterBar2" useExportToExcel="true" beforeExport="onBeforeExport" useVariantManagement="true" useTablePersonalisation="true" header="GL Accounts" showRowCount="false" persistencyKey="SmartTableRefApp_Explored" enableAutoBinding="false" beforeRebindTable="onBeforeRebindTable1" class="sapUiTinyMargin customSmartTable" fitContainer="true" RequestAtleastFields="ID" initiallyVisibleFields="ID" tableType="Table" initialise="onInitialise">
code to bind model to smart table control
var oNamedModel = this.getOwnerComponent().getModel("oSummaryModel");
this.byId("idProfitSmartTable2").setModel(oNamedModel);
Setting binding path in onRebindBeforeTable
oEvent.getSource().setModel(this.getOwnerComponent().getModel("oSummaryModel"))
var sFilter =
"/Z***(some parameters)/Results"
oEvent.getSource().setTableBindingPath(sFilter);
Network call is not triggering.
it always says "Right now, there are no visible columns in the table. Please select the columns you need in the table settings."
when i try to select columns, no columns are displayed.
am i doing anything wrong ? or is there any limitation like smart table can be binded only to default odata model ?.
please advice. Thanks.
Siddarth
User | Count |
---|---|
75 | |
10 | |
9 | |
7 | |
6 | |
6 | |
6 | |
6 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.