我正在尝试这个例子,我必须添加总产品计数,即屏幕上显示的总表行数 .
https://sapui5.netweaver.ondemand.com/sdk/explored.html#/sample/sap.m.sample.Table/preview
当我尝试访问JSON对象的长度,即:
<headerToolbar>
<Toolbar>
<Label text="Products"></Label>
<Label text=""{ path: '/ProductCollection', formatter: 'sap.m.sample.Table.Formatter.totalFormatter' }""> </Label>
</Toolbar>
</headerToolbar>
totalFormatter:function(results) { return results.length; }
我得到SAPUI5不是渲染错误:
未捕获的TypeError:无法读取未定义的属性“长度”
1 回答
我通过修改示例的代码来回答您的问题 .
然后你将获得总表行 .
基本思想是利用计算的数据字段绑定来获得结果长度 . 文档可以在here找到 .