0
votes

I used SmartTable with the property initiallyVisibleFields. I bound ODataModel to it. The problem is when I want to show all fields of ODataModel, e.g. after I click on SmartTable's row and try to display it in the dialog. I just see fields from initiallyVisibleFields property. It looks like ODataModel is filtered with initiallyVisibleFields property.

I was thinking about JSONModel where I put copy of ODataModel before it is bind to SmartTable, but I am planning to use SmartFilterBar, so index of shown data in the table will be changed after filtering. So I can not simply pull data from JSONModel. I can still filter data from JSONModel based on the fields I get from ODataModel filtered with initiallyVisibleFields but there I can still get different data, because there can be differences in the fields which are hidden.

Please, can you advice me how to solve this issue?

Thanks for any tips.

...

return Controller.extend("ABC.View1", {     
    oDialog: null,

    onInit: function() {
        var oModel, oView;
        oModel = new ODataModel("/sap/opu/odata/sap/ABC/", {
            useBatch: false
        });
        oView = this.getView();
        oView.setModel(oModel); 

        this._createSmartTable();
    },

    _createSmartTable: function() {
        var oSmartTable = new SmartTable('idSmartTable',{
            entitySet: "ABCListSet",
            tableType: "ResponsiveTable",
            sStyleClass: "sapUiResponsiveContentPadding",
            initiallyVisibleFields: "A,B,C,D",              
            showRowCount: false,
            enableAutoBinding: true,
            demandPopin: false,
            useVariantManagement: false,
            useExportToExcel: false,
            useTablePersonalisation: true,
        });

        // Register event row click
        var that = this;
        var oTable = oSmartTable.getTable();
        oSmartTable.attachDataReceived(function() {
            var aItems = oTable.getItems();
            if (aItems.length === 0) return;
            $.each(aItems, function(oIndex, oItem) {
                oItem.detachPress(that._createDialog);
                oItem.setType("Active");
                oItem.attachPress(that._createDialog);
            });
        });

        var oVBox = new VBox();         
        oVBox.addItem(oSmartTable);

        var oPage = this.getView().byId("idPage");
        oPage.addContent(oVBox);
    },      

    _createDialog: function(oEvent) {
        //HERE I the oEvent has data filtered by initiallyVisibleFields property of Smarttable.
    },

});
...
1

1 Answers

0
votes

Do I understand you correctly that you want to show the complete entry in a dialog? The SmartTable uses $select statements to only load the fields of an entity that are also shown in the table. If you want to load all, I think you should add them in the requestAtLeast property.