>
> Array.each(obj, function(item, index){
>     if (item == '456') console.log("info22:", item.id);
> });


That won't work, use Object.filter/each instead, like Steffen said.


On Thu, Feb 21, 2013 at 3:24 PM, Sitthykun LY <[email protected]>wrote:

> Try this one
>
> Array.each(obj, function(item, index){
>     if (item == '456') console.log("info22:", item.id);
> });
>
> Cheer!?
>
>
> On Thu, Feb 21, 2013 at 9:10 PM, n3on <[email protected]>wrote:
>
>> Hi,
>>
>> you could use Object.filter:
>> http://mootools.net/docs/core/Types/Object#Object:Object-filter
>>
>> Take a look at this fiddle: http://jsfiddle.net/unlooped/K7WfE/7/
>>
>> Best,
>> Steffen
>>
>>
>> On Thursday, February 21, 2013 11:41:36 AM UTC+1, Hamburger wrote:
>>>
>>> Hello,
>>> I would like to find a value in an data-object. (Has the given ID a true
>>> ajax-flag?)
>>> I made this to find the value:
>>> http://jsfiddle.net/K7WfE/6/
>>>
>>> //the data object
>>> var obj = {
>>> 'apple' : { 'id': '123', 'valid' : 0 , 'ajax' : 1 } ,
>>> 'bwe' :   { 'id': '456', 'valid' : 1 , 'ajax' : 1 } ,
>>> 'na' :    { 'id': '789', 'valid' : 0 , 'ajax' : 0 } ,
>>> 'ana' :   { 'id': '345', 'valid' : 1 , 'ajax' : 1 } ,
>>> };
>>>
>>> var ajax = [];  //to store the result
>>> for( var name in obj ) {
>>>     if(obj[name].valid ==true) ajax.push(obj[name].id );
>>> }
>>> console.log(ajax);
>>>
>>> var search = '456'; //given ID
>>>
>>> var info = ajax.contains(search); //gives the status back.
>>>
>>> console.log("Info: ",info);
>>>
>>> I think this is not very elegant.
>>> Is there a better mootools way?
>>> thanks for any suggestion in advance
>>>
>>  --
>>
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "MooTools Users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected].
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>>
>
>
>
> --
> Sitthykun LY
> a little developer in the big world \o/
> mobile: +85595 7788 39
> skype: cityx9
> twitter: sitthykun <http://twitter.com/sitthykun>
> site: niyum.com
>
>  --
>
> ---
> You received this message because you are subscribed to the Google Groups
> "MooTools Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"MooTools Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to