extjs中我要获得传过来的list总数用store.getTotalCount()取得总数为什么取得为0

extjs中我要获得传过来的list总数用store.getTotalCount()取得总数为什么取得为0?
取得不了总数呢?有哪位朋友知道指点一下 谢谢了

1个回答

getTotalCount() : Number
Gets the total number of records in the dataset as returned by the server.
If using paging, for this to be accurate, the data object used by the Reader must contain the dataset size. For remote data sources, the value for this property (totalProperty for JsonReader, totalRecords for XmlReader) shall be returned by a query on the server. Note: see the Important note in load.

这个属性需要你在reader的配置中映射totalProperty,然后返回json中有这个字段.
一般是用来在分页的时候知道总数的.

如果你只是想知道store当前的数据数,就用getCount()

立即提问
相关内容推荐