on 04-23-2015 8:23 PM
Hi,
I have a view and on a click of a icon, it displays a search popup window. Upon searching, we display the results in a list in the same popup. I need to do a filtering on this list.
The UI for the popup is defined in Dialog.Fragment.xml file. The list is also defined in the dialog fragment.
I wrote the below statements on the action handler of filtering in S2 controller.
var list = this.getView().byId("idList");
var binding = list.getBinding("items");
binding.filter(aFilters, "Application");
When I debug the code, list is coming as undefined.
How to retreive the id of the list from a dialog fragment.
I have attached the relative files for reference.
Regards
V
this._oDialog = sap.ui.xmlfragment("MyDialog", "cus.sd.priceavailability.check.ZSD_PRAV_MON.view.Dialog", this);
var list = this.getView().byId("MyDialog--idList");
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
My code looks like below now.
onFilter: function(oEvent) {
// add filter for search
var aFilters = [];
var sQuery = oEvent.getSource().getValue();
if (sQuery && sQuery.length > 0) {
var filter = new sap.ui.model.Filter("Mcod1", sap.ui.model.FilterOperator.Contains, sQuery);
aFilters.push(filter);
}
// update list binding
this._oDialog = sap.ui.xmlfragment("MyDialog", "cus.sd.priceavailability.check.ZSD_PRAV_MON.view.Dialog", this);
var list = this.getView().byId("MyDialog--master1List");
var binding = list.getBinding("MyDialog--items");
binding.filter(aFilters, "Application");
},
I am getting the below errors in console
webidetestingonsxal-p808141trial.dispatcher.hanatrial.ondemand.com/view/S2Custom.controller.js:180 Uncaught TypeError: Cannot read property 'getBinding' of undefined
sap-ui-core.js:80 2015-04-23 14:39:38 [index.html] adding element with duplicate id 'MyDialog--salesOffice' - y @ sap-ui-core.js:80
sap-ui-core.js:135 Uncaught Error: Error: adding element with duplicate id 'MyDialog--salesOffice'
sap-ui-core.js:80 2015-04-23 14:39:38 [index.html] adding element with duplicate id 'MyDialog--salesGroup' - y @ sap-ui-core.js:80
sap-ui-core.js:135 Uncaught Error: Error: adding element with duplicate id 'MyDialog--salesGroup'
sap-ui-core.js:80 2015-04-23 14:39:39 [index.html] adding element with duplicate id 'MyDialog--salesOffice' - y @ sap-ui-core.js:80
sap-ui-core.js:135 Uncaught Error: Error: adding element with duplicate id 'MyDialog--salesOffice'
I wrote the below code
onFilter: function(oEvent) {
// add filter for search
var aFilters = [];
var sQuery = oEvent.getSource().getValue();
if (sQuery && sQuery.length > 0) {
var filter = new sap.ui.model.Filter("Mcod1", sap.ui.model.FilterOperator.Contains, sQuery);
aFilters.push(filter);
}
// update list binding
this._oDialog = sap.ui.xmlfragment("MyDialog", "cus.sd.priceavailability.check.ZSD_PRAV_MON.view.Dialog", this);
var list = sap.ui.getCore().byId("MyDialog--master1List");
list.bindAggregation("items", {path:pathStr
,template : new sap.m.ObjectListItem(
{title:"{Mcod1} ",
number : "", type: "Active",
attributes: [new sap.m.ObjectAttribute({
text : "(#{Kunn2}, {Vkgrp}, {Vkbur})"
}),
new sap.m.ObjectAttribute({
text : "#{Stras}, {Mcod3}, {Regio}-{Pstlz}"
})],
filters:aFilters
}
})
});
But displaying the below errors in console
2015-04-23 17:42:12 [index.html] adding element with duplicate id 'MyDialog--salesOffice'
Uncaught Error: Error: adding element with duplicate id 'MyDialog--salesOffice'
2015-04-23 17:42:12 [index.html] adding element with duplicate id 'MyDialog--salesGroup'
Uncaught Error: Error: adding element with duplicate id 'MyDialog--salesGroup'
move
this._oDialog = sap.ui.xmlfragment("MyDialog", "cus.sd.priceavailability.check.ZSD_PRAV_MON.view.Dialog", this);
this.template = new sap.m.ObjectListItem(
{
title : "{Mcod1}",
number : "",
type: "Active",
attributes: [
new sap.m.ObjectAttribute({text : "(#{Kunn2}, {Vkgrp}, {Vkbur})"}),
new sap.m.ObjectAttribute({text : "#{Stras}, {Mcod3}, {Regio}-{Pstlz}"})
]
});
to onInit
and do
list.bindAggregation("items",
{
path : pathStr,
filters : aFilters
template : this.template
});
in onFilter
User | Count |
---|---|
83 | |
10 | |
10 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.