sapui5 - how to get 1 item from a data binding in the controller? -
i have table filled data via data binding. , in controller i'm trying loop on items of databinding. have far can't work.
colorrows : function(otable) { var items = otable.getbinding("items"); var rowcount = items.length; //number of visible rows var currentrowcontext; (var = 0; < rowcount; i++) { currentrowcontext = items[i].getvalue(); //this won't work } }
so need value item index matches i.
edit: i'm using sap.m.table
as keshet mentioned, depends on table using. here exapmle sap.ui.table.table
. first context of each row , can access data saved on row (btw, there no such thing rowvalue):
colorrows: function(otable) { var arows = otable.getrows(); var currentrowvalue; (var = 0; < arows.length; i++) { var orowcontext = otable.getcontextbyindex(i); if (orowcontext) { var orowobject = orowcontext.getobject(); // or can use getproperty method var osinglevalue = orowcontext.getproperty("yourpropertyname"); } } }
Comments
Post a Comment