根据要求,我需要将自定义过滤器栏值与智能表绑定。他们不需要智能过滤器。因此,我使用了“执行”按钮来实现过滤器栏。使用“单击运行”按钮时,我需要将过滤器值与智能表绑定。
我的Xml代码:
<smartTable:SmartTable id="smartTable_ResponsiveTable" demandPopin="false" tableType="Table" editable="false"
entitySet="EntitySet" showVariantManagement="true" useVariantManagement="true" useTablePersonalisation="true"
header="Request Pending My Action" showRowCount="true" useExportToExcel="true" enableAutoBinding="true" initialise="onInitialise"
persistencyKey="SmartTablePKey" smartVariant="pageVariantId" showFullScreenButton="true"
initiallyVisibleFields="Vin,Acind,Bukrs,Ekorg,Zzprimary,Zzscom1,Bunit,Lifnr,Name1,Status,Uname,Credat,Cretim"></smartTable:SmartTable>
控制器:
onSearch: function() {
var Vin = new Filter("Vin", "EQ", this.getView().byId("Vin").getValue());
var Acind = new Filter("Acind", "EQ", this.getView().byId("Acind").getValue());
var Bukrs = new Filter("Bukrs", "EQ", this.getView().byId("Bukrs").getValue());
var Ekorg = new Filter("Ekorg", "EQ", this.getView().byId("Ekorg").getValue());
var Zzprimary = new Filter("Zzprimary", "EQ", this.getView().byId("Zzprimary").getValue());
var Zzscom1 = new Filter("Zzscom1", "EQ", this.getView().byId("Zzscom1").getValue());
var Bunit = new Filter("Bunit", "EQ", this.getView().byId("Bunit").getValue());
var Lifnr = new Filter("Lifnr", "EQ", this.getView().byId("Lifnr").getValue());
var Name1 = new Filter("Name1", "EQ", this.getView().byId("Name1").getValue());
var Status = new Filter("Status", "EQ", this.getView().byId("Status").getValue());
var Uname = new Filter("Uname", "EQ", this.getView().byId("Uname").getValue());
var Credat = new Filter("Credat", "EQ", this.getView().byId("Credat").getValue());
var Cretim = new Filter("Cretim", "EQ", this.getView().byId("Cretim").getValue());
var aFilters = [];
aFilters.push(new Filter([Vin, Acind, Bukrs, Ekorg, Zzprimary, Zzscom1, Bunit, Lifnr, Name1, Status, Uname, Credat, Cretim], true));
var oSmartTable = this.getView().byId("smartTable_ResponsiveTable");
oSmartTable.getTable().bindRows("/EntitySet", null, null, aFilters);
},
请提供实现此目的的代码。
答案 0 :(得分:0)
SmartTable的工作原理有所不同。 这是伪代码。
onSearch: function(){
<Get reference to SmartTable>
<call rebindTable() API on SmartTable>
}
在定义SmartTable时,将onBeforeRebindTable
附加到事件beforeRebindTable
。
onBeforeRebindTable : function(){
<get all filters from your custom filterbar into aFilters as you did in your current code.>
<oBindingParams.filters = aFilters>
}