How to use applyVariant function on smarttables?

后端 未结 1 1278
轻奢々
轻奢々 2021-01-15 01:58

How can I use applyVariant function on a smarttable?

The documentation exist here:

https://sapui5.hana.ondemand.com/sdk/#/api/sap.u

相关标签:
1条回答
  • 2021-01-15 02:17

    Just try to apply a filter on your smart table and in the beforeRebindTable event of your smart table try to use the following code:

    onBeforeRebindTable: function(oEvent) {
       var oSmartTable = oEvent.getSource();
       console.log(oSmartTable.fetchVariant());
    }
    

    By using the fetchVariant function, you can see what the structure of the variation is. For example for filter it is like this:

    {
         filter: {
                        filterItems: [{
                            columnKey: "YourSelectedColumn",
                            exclude: false, 
                            operation: "EQ", 
                            value1: "SomeEnteredValue",
                            value2: ""
                        }]
                    }
    }
    

    Then you can use this object for the applyVariant function as its first parameter.

    0 讨论(0)
提交回复
热议问题