find

finds the item that corresponds to the specified parameters

object find(string|function by,string match);

Parameters

bystring|functionthe search criterion (either the key of the item attribute or a filtering function)
matchstringthe value of the item attribute

Returns

objectthe object of the matching item

Example

//searching for an item by the attribute key
var item = component.data.find({by:"text",match:"Manager"});
 
//searching for an item by the function
var item = component.data.find(function(item){
    if(item.text==="Manager"||item.text==="Marketer"){return true}
});

Related samples

Back to top