Ext store 根据valuefield获取对应的其他值

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/Ann_mi/article/details/80352456

有时候我们在用store 的时候,会有需求要求我们出了valuefield和displayfield还需要其他的值(必须保证自己要求的那个值在我们请求的数据里面有返回给我们)
这个时候我们就可以用findRecord()方法
findRecord( String fieldName, String/RegExp value, [Number startIndex], [Boolean anyMatch], [Boolean caseSensitive], [Boolean exactMatch] ) : Ext.data.Model
Finds the first matching Record in this store by a specific field value.

When store is filtered, finds records only within filter.

Parameters
fieldName : String
The name of the Record field to test.

value : String/RegExp
Either a string that the field value should begin with, or a RegExp to test against the field.

startIndex : Number (optional)
The index to start searching at

Defaults to: 0

anyMatch : Boolean (optional)
True to match any part of the string, not just the beginning

Defaults to: false

caseSensitive : Boolean (optional)
True for case sensitive comparison

Defaults to: false

exactMatch : Boolean (optional)
True to force exact match (^ and $ characters added to the regex).

Defaults to: false
例如:
store.findRecord(“valuefield/displayfield(对应的字段)”, value(获取到的值), 0, false, false, true).data.VALUE_ID
则可以查到value对应的value_id的值

阅读更多
想对作者说点什么?

博主推荐

换一批

没有更多推荐了,返回首页