Skip to Content
0

SAPUI5 Smart Table with Function Import

Jun 06, 2017 at 07:44 AM

125

avatar image
Former Member

Hello Experts,

I am creating a smart table whose data will be populated from output of a Function Import. Return type of output table of function import is captured in a entity set which is being used in smart table. Entity set has required annotations created.

But smart table is showing 'No Data'.

Below is piece of code.

<!-- View XML File -->
<smartTable:SmartTable id="idTable" entitySet="DataSet" tableType="Table" useExportToExcel="true" useVariantManagement="false" useTablePersonalisation="true" persistencyKey="SmartTableAnalytical_Explored" enableAutoBinding="false" app:useSmartField="true">
<!-- layout data used to make the table growing but the filter bar fixed -->
<smartTable:layoutData>
      <FlexItemData growFactor="1" baseSize="0%"/>
</smartTable:layoutData>

Controller code:

var sURI = "/sap/opu/odata/sap/<SERVICE>/"; 
var oDataModel = new sap.ui.model.odata.ODataModel(sURI, true);
this.getView().setModel(oDataModel);

updateTable: function()
{
    var oView = this.getView();
    var oModel = oView.getModel();
    if (true)
    {
        oModel.callFunction("/GetData", {
	method:"GET",
	urlParameters: oUrlParams,
	success: jQuery.proxy(this.successCall, this),
	error: jQuery.proxy(this.errorCall,this)
    }
},

successCall: function(oData) {
     var oView = this.getView();
     var oTable = oView.byId("idTable");

     var uri = "/sap/opu/odata/sap/<SERVICE>/";
     var oModelnew = new sap.ui.model.odata.ODataModel(uri, true);
     oModelNew.setData(oData);
     oView.setModel(oModelnew);
     oTable.setModel(oModelnew);			
}
10 |10000 characters needed characters left characters exceeded

Something is wrong with the code syntactically itself. For example oDataModel does not have a method setData(JSONModel does). Secondly for Smart table there is an implicit triggering to bound entitySet. If you want to achieve it as function import why do you need a smart table as opposed to a sap.m.Table

0
Former Member
Veeraraghavan Narasimhan

Yes Veeraraghavan, setData is a wrong statement here. I was trying with different methods of oDataModel &JSONModel and missed to remove that.

I was looking for smart table so that it's default features like sorting/filtering/rearranging of columns, table personlization, export to excel etc. can be used out of the box. Else we have to go for customization to implement these features.

Thanks,

Saurabh

0
* Please Login or Register to Answer, Follow or Comment.

0 Answers