on 07-20-2016 8:01 AM
Dear community,
I want to group my entries in my Master View.
<List
id="list"
mode="{device>/listMode}"
select="handleListSelect"
items="{path: '/projects?$expand=customer,wbs_type,project_employees,project_status,details,time_trackings',
sorter: {
path : 'customer/CUSTOMER_NAME',
group: true
}
}" >
The Grouping works but the app does not recognize same CUSTOMER_NAMEs
Two of the attached entries have the same CUSTOMER_ID but I want to group after their CUSTOMER_NAME.
How can I fix it.
Best regards,
Marcel
Hi Marcel,
Actually I didn't get you properly. If you are looking for custom grouping you can go through below link:
http://scn.sap.com/community/developer-center/front-end/blog/2013/11/29/custom-sorter-and-grouper
Thanks & Regards,
Namita
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello,
I don't think that this is a custom grouper.
I have the following structure in table project which is binded to the Master List.
WBS_ELEM
...
CUSTOMER_ID
...
With expand customer, I can use customer/CUSTOMER_NAME for the output in the list. That works.
But If I group at CUSTOMER_ID it works but then the groupheader is an ID. I want to group after CUSTOMER_NAME.
And this partially works. The grouping header is correct, but why does come the values twice although they are not unique?
Best regards,
Marcel
Ok. This is strange, if both the customer names are same then it should come only once, but if it is not I mean by letters also in capital or lower case(both should be Identically same). But In the img I can see no difference on both names. Please check the data once.
An example of same value but different case - https://plnkr.co/edit/qYxPF7xT4lcUNrpA7pff?p=preview
here I made one "Available" to "available" so it's showing 3 groups.
Thanks
That might be the issue.
I'm trying to make an workaround with: groupHeaderFactory: '.getGroupHeader'
But here I still have a problem.
View:
items="{path: 'MasterModel>/projects?$expand=customer,wbs_type,project_employees,project_status,details,time_trackings',
sorter: {
path : 'MasterModel>CUSTOMER_ID',
group: '.getGroup'
},
groupHeaderFactory: '.getGroupHeader'
}" >
Controller:
getGroup: function (oContext)
{
var l_customerName;
var l_customerId;
//get CUSTOMER_NAME
var oModel = this.getView().getModel("MasterModel");
oModel.read("/customers", null, null, true, fSuccess, fError);
function fSuccess(oEvent)
{
customerId = oContext.getProperty("CUSTOMER_ID") - 1;
var oCustomers = new sap.ui.model.json.JSONModel(oEvent.results);
l_customerName = oCustomers.getProperty("/" + customerId + "/CUSTOMER_NAME");
//console.log(l_customerName);
};
function fError(oEvent){
console.log("An error occured while reading Customers!")
};
return {
key: l_customerId,
title: l_customerName || "No Customer"
};
},
getGroupHeader: function (oGroup){
//Set Header
console.log(oGroup);
return new sap.m.GroupHeaderListItem( {
title: oGroup.title,
upperCase: false
});
},
But if I use "getGroup" the App does not call the methode getGroupHeader, only if I set group: true. But then I can't differntiate between a Key and a title.
Regrads,
Marcel
Hi,
In your case customer is the data source name right? so replace the "/" by ">". Try it
Thank you,
Regards,
JK
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
76 | |
10 | |
8 | |
6 | |
6 | |
5 | |
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.