on 12-09-2013 9:36 PM
Hi,
I got a list Item:
itm = new sap.m.ObjectListItem({
title : "Ansprechpartner",
icon:sap.ui.core.IconPool.getIconURI("employee"),
type: "Navigation",
unread : true,
counter: 3,
press: showContacts
});
menuList.addItem(itm);
The List Item should be bind to a model.
Instead of having hardcoded the value "3" I want do have a counter showing the elements under /customer/0/contacts
I there a syntax, how I can do a count, e.g.
counter: {contacts@count},
Thanks
Jens
var actionListItem = new sap.m.ObjectListItem("action",
{
title : "{name}",
icon:sap.ui.core.IconPool.getIconURI("employee"),
type: "Navigation",
unread : true,
counter: "{counter}"
});
$.each(data.list, function(i, item) {
Object.defineProperty(data.list[i], "counter", { get : function(){
return this.contacts.length; } } );
});
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Jens,
For this requirement you will have to implement inlinecount to the entity set contacts on the odata side. The Contact Entity Type must also have ContactsCount field to which you will set the inlinecount.
Then you can directly bind counter : "{ContactsCount}". It will show the count.
Regards,
Pruthvi.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
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.