on 11-06-2022 9:21 AM
hi
i cant bind new data to table, I don't know where my problem is.
after click in "filter" button i get new data from odata and convert it to json and set model
but in view i cant see any data
view:
<mvc:View xmlns:html="http://www.w3.org/1999/xhtml" xmlns="sap.m" xmlns:core="sap.ui.core" xmlns:mvc="sap.ui.core.mvc" xmlns:l="sap.ui.layout" xmlns:f="sap.ui.layout.form" xmlns:smartForm="sap.ui.comp.smartform" xmlns:smartField="sap.ui.comp.smartfield" controllerName="SOPsales_order_approval.controller.View1" displayBlock="true">
<App>
<pages>
<Page>
<content>
<Table id="idProductsTable" inset="false" items="{/E1Set}">
<columns press="tbl_row_click">
<Column>
<Text text="موعد تحویل"/>
</Column>
<Column>
<Text text="پیش پرداخت"/>
</Column>
<Column>
<Text text="ی"/>
</Column>
<Column>
<Text text="مبلغ سفارش"/>
</Column>
<Column>
<Text text="نام فروشگاه"/>
</Column>
</columns>
<items>
<ColumnListItem vAlign="Middle" press="tbl_row_click" type="Active">
<cells>
<Text text="{Give_Date}"/>
<Text text="{Prepayment_Flg_Desc}"/>
<Text text="{Prepayment_Flg_Desc}"/>
<Text text="{OrderPrice}"/>
<Text text="{Shop_Name}"/>
</cells>
</ColumnListItem>
</items>
</Table>
</content>
</Page>
</pages>
</App>
</mvc:View>
btn_filter_press: function(oEvent) {
debugger;
var that = this;
var role = this.getView().byId('role').getSelectedItem().getKey();
var branch = this.getView().byId('branch').getSelectedItem().getKey();
var state = this.getView().byId('state').getSelectedItem().getKey();
var Filters_array = {
values: []
};
var Filter = new sap.ui.model.Filter({
path: "role",
operator: sap.ui.model.FilterOperator.EQ,
value1: role
});
Filters_array["values"].push(Filter);
var Filter2 = new sap.ui.model.Filter({
path: "branch",
operator: sap.ui.model.FilterOperator.EQ,
value1: branch
});
Filters_array["values"].push(Filter2);
var Filter3 = new sap.ui.model.Filter({
path: "state",
operator: sap.ui.model.FilterOperator.EQ,
value1: state
});
Filters_array["values"].push(Filter3);
var reqFilters = new sap.ui.model.Filter({
filters: Filters_array.values,
and: true,
});
this.oDataModel.read("/E1Set",{
filters: reqFilters.aFilters,
method: "GET",
success: function(oResults) {
var oTable = that.byId("idProductsTable");
// oTable.unbindItems();
oTable.setModel(new JSONModel(oResults, true), "E1Set");
},
error: function (oError){
debugger;
}
})
},
success: function(oResults) {
debugger;
var oModel_view = that.getView().getModel("viewModel");
oModel_view.setProperty("/E1Set",oResults.results);
var oTable = that.getView().byId("idProductsTable");
oTable.setModel(oModel_view, "viewModel");
},
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
79 | |
9 | |
9 | |
7 | |
7 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.