Dinesh
Dinesh

Reputation: 1

Application with SmartTable and JSONModel binding

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

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);
            });

Please suggest me how to do this.

Upvotes: 0

Views: 4292

Answers (2)

Geraldo Megale
Geraldo Megale

Reputation: 363

it's not possible to bind jsonData Model to a smart table. The columns/rows on a smart table are defined based on the metadata.xml of an odata service.

Check this: https://answers.sap.com/questions/90310/application-with-smarttable-and-jsonmodel-binding.html

Upvotes: 2

Gabriel Gomez
Gabriel Gomez

Reputation: 91

What do you obtain if you attempt to define the columns in the view?

<smartTable:columns>                        
(your columns)                  
</smartTable:columns>

Regards, Gabriel

Upvotes: 0

Related Questions