Reputation: 2735
does extjs contain method equivalent to inArray? i checked the API but found nothing!
here is the jquery snippet that need urgent conversion:
if ($.inArray(checkbox.inputValue, values) >= 0)
where values is array.
thanks,
Upvotes: 2
Views: 2781
Reputation: 3541
ExtJS 4 has Array.contains method:
Ext.Array.contains(MyArray, MyString); // returns bool
Upvotes: 2
Reputation: 1
You need to use the Ext.Array.indexOf
method:
Ext.Array.indexOf( Array array, Object item, [Number from] ) : Number
The resulting code would look like this:
if (Ext.Array.indexOf(checkbox.inputValue, values) >= 0)
Upvotes: 0
Reputation: 33769
Ext JS has Array.indexOf, which does exactly the same thing that the unfortunately-named jQuery.inArray does:
if(values.indexOf(yourValue) !== -1)
Upvotes: 5
Reputation: 163248
Ext.js does not appear to have this function. See http://docs.sencha.com/core/manual/
You can monkey patch this in if you like:
Ext.inArray = function(value, collection) {
return collection.indexOf(value) !== -1;
};
Upvotes: 2