Aaron ,
I figgued something like that was going on. Thanks for the break down
it helped alot . :)
Matt,
yah i saw i forgot the "this" after i sent out the msg :/ heh.
On Wed, May 12, 2010 at 2:23 PM, Matthew Hazlett <[email protected]> wrote:
> Where you had:
>
> milk_Grid.inject(this.EL);
>
>
>
> Should be:
>
> this.milk_Grid.inject(this.EL);
>
>
>
> and you need to scope your each...
>
>
>
> data.each(function(item,index){
> alert(index + ': ' + item);
> this.milk_Grid.push(item);
> }.bind(this));
>
>
>
>
>
> Fixed:
>
> http://mootools.net/shell/T8xDe/4/
>
>
>
>
>
> *From:* [email protected] [mailto:
> [email protected]] *On Behalf Of *Paul Saukas
> *Sent:* Wednesday, May 12, 2010 1:37 PM
> *To:* [email protected]
> *Subject:* [Moo] Noobie Issues with array.each
>
>
>
> OK,
>
> I am having a bit of a problem as I try to teach myself classes. I have
> the following code :
>
> Mooshell: http://mootools.net/shell/T8xDe/3/
>
> Class Function:
>
> loadData:function(data){
> data.each(function(item,index){
> alert(index + ': ' + item);
> this.milk_Grid.push(item);
> });
> alert('Data Loaded!');
> }
>
> Call To class Function :
>
> var data = [
> ['border', '#FF0000'],
> ['color' , '#0000FF'],
> ['font-weight', 'bold']
> ];
>
> myTable.loadData(data);
>
>
> What vexes me is i get an error saying "this.milk_Grid" is undefined. This
> only happens if i call the push on it from within the each loop so I am not
> sure if it is a matter of the each overriding the "this", or if i am just
> doing something horribly wrong.
>