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

有时候我们在用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的值

猜你喜欢

转载自blog.csdn.net/ann_mi/article/details/80352456
ext