cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Application with SmartTable and JSONModel binding

Former Member
17,505

Hi All,

I'm trying to develop SAPUI5 application using smart table with the json model binding. While running the program I'm getting error I'm sharing that snapshot with you.I'm sharing my code, please suggest me to how to make this work.

And please say how to refer JSONModel data/entity set to the annotations.xml file

In view:

<smartTable:SmartTable 
        id="smartTable_ResponsiveTable"
        smartFilterId="smartFilterBar" 
        tableType="ResponsiveTable" 
        editable="false"
        entitySet="tableSet"
        useVariantManagement="false"
        useTablePersonalisation="false" 
        header="Products" 
        showRowCount="true"
        useExportToExcel="false" 
        enableAutoBinding="true"
        initiallyVisibleFields="name">
    </smartTable:SmartTable>

In Controller:

var array = [{
                "name" : "Dinesh",
                "id" : "123"
            },
            {
                "name" : "Nikhil",
                "id" : "456"
            },{
                "name" : "Pulkit",
                "id" : "789"
            }];
            var model = new sap.ui.model.json.JSONModel();
            model.setData({
                tableSet: array
            });
            this.getView().byId("smartTable_ResponsiveTable").setModel(model);
            });

I'm getting above error after running it. According to my knowledge smart table not able to get the data( that is entity set configuration issue). Please suggest me how to fix this and how to write annotations.xml file for JSONModel data

Regards,
Sai Ram Dinesh Pallapotu

View Entire Topic
venkatakalyan_karanam
Active Contributor
0 Likes

Hi Sai Ram

Smart Controls need OData metadata info like EntitySet/Attributes to get the data from the service. In the explorer they used JSON Model because that works based on MockServer. MockServer mimics the oData calls, moreover you can find the JSON file name as same name with the EntitySet which is defined in the metadata file of ODATA.

There is no way to use Smart Controls with JSON files directly, they are designed and intended for the ODATA model.

Thanks and Regards

Kalyan

Former Member
0 Likes

Hi Venkatakalyan,

Thank you for your reply. You are correct. But I got requirement like develop an application using smart controls with JSON model data. So is there any way that, by using mock server can I make a relation between JSON model data and metadata.xml file.

Regards,

Sai Ram Dinesh

Former Member
0 Likes

No there is not - metadata.xml always comes from oData services for oData model not for JSON model.