How can I use applyVariant
function on a smarttable
?
The documentation exist here:
https://sapui5.hana.ondemand.com/sdk/#/api/sap.u
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.