Hi,
I was wondering which is the best way to update a table.
I tried with the folowwing code:
//Search parameters | ||
var d_f = '2000.01.01'; | ||
var d_t = '2013.08.20'; | ||
var t = 'ANY'; | ||
var a = ''; | ||
var c_f = 0; | ||
var c_t = 9999999; |
var oFilter2 = new sap.ui.model.Filter("username", sap.ui.model.FilterOperator.EQ, sap.ui.getCore().getControl("txt_username").getValue()); | ||
var oFilter3 = new sap.ui.model.Filter("cost_from", sap.ui.model.FilterOperator.EQ, c_f); | ||
var oFilter4 = new sap.ui.model.Filter("cost_to", sap.ui.model.FilterOperator.EQ, c_t); | ||
var oFilter5 = new sap.ui.model.Filter("date_from", sap.ui.model.FilterOperator.EQ, d_f); | ||
var oFilter6 = new sap.ui.model.Filter("date_to", sap.ui.model.FilterOperator.EQ, d_t); | ||
var oFilter7 = new sap.ui.model.Filter("cost_type", sap.ui.model.FilterOperator.EQ, t); | ||
var oFilter8 = new sap.ui.model.Filter("approval", sap.ui.model.FilterOperator.EQ, a); |
var sURI2 = "http://sapecc.system.loc/sap/opu/odata/sap/ZWUYTSR_CM_EXPENSES_SEARCH/"; | |||
var oModel2 = new sap.ui.model.odata.ODataModel(sURI2, false, "username", "password"); | |||
oTable2.setModel(oModel2); | |||
oTable2.bindRows("/zwuytsr_expenses_searchCollection", null, null, [oFilter2, oFilter3, oFilter4, oFilter5, oFilter6, oFilter7, oFilter8]); |
When one of the search parameters changes I use this code to change refresh my model:
var type = new sap.ui.commons.DropdownBox({change : function(){ |
t = this.getValue();
console.log(t);
oFilter7 = new sap.ui.model.Filter("cost_type", sap.ui.model.FilterOperator.EQ, t);
oModel2.updateBindings({
bForceUpdate: true |
});
oModel2.refresh();
}});
It seems like the filter doesn't change, because in the ABAP debugger the value always stays the same, in this case cost_type = 'ANY'.
Anyone who can tell me what I'm doing wrong?
Thanks!