i cant flatten this, sorry. i need an array of elements (tasks),
according to my html markup.

<taskgroup>
   <task 1>
   <task 2>
   <task 3>
</taskgroup>
<task 4>
<task 5>

should become: [ [ task1, task2, task3 ], task4, task5 ]. my code
looks as follows:

$$('.task').each( function(item) {

                        // this shows me, that a taskgroup starts

                        if ( item.hasClass('taskgroup-title') ) {

                                var array = [];

                                array.push(item.get('id'));

                                item.getAllNext('.task').each( 
function(sub_item) {
                                        if ( 
!self.options.tasksArray.contains(sub_item.get('id')) )
array.push(sub_item.get('id'));
                                });

                                self.options.tasksArray.push(array);

                                self.options.tasksArray.erase(array);

                        } else {
                                var id = item.get('id');
                                if ( !self.options.tasksArray.contains( id ) )
self.options.tasksArray.push(item.get('id'));
                        }

                });

On 27 Sep., 19:53, Ryan Florence <[email protected]> wrote:
> Array.flatten first.
>
> On Sep 27, 2010, at 11:31 AM, [email protected] wrote:
>
> > im cuurently wondering if array.unique() wont work with
> > multidimensional arrays. my array:
>
> > [ ["task-1", "task-2"], "task-2", "task-112", "task-108", "task-113",
> > "task-109", "task-114", "task-54", "task-55", "task-58", "task-59",
> > "task-107", "task-110", "task-111" ]
>
> > won't cleaned up. you notice the double-appearance of "task-2".

Reply via email to