Nested Multi-Select-List.

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Nested Multi-Select-List.

dtrussardi@tiscali.it
Hello All,
 
i work with VW 7.4.1 and  SeasideScriptaculous (2.6b1.108.0,mbany) from store.cincomsmalltalk.com:5432_store_public.
 
My objective is create two Multi-Select-List, where,
         when i change the Master Multi-Select-List selection i set the selections of the Slave Multi-Select-List ( with the Master Multi-Select-List selection )

For test my solution i  change the Scriptaculous-Testing-> SUAllTest ->SUFormTest.
 
The relative method renderMultiSelectListOn: html
    now is::
renderMultiSelectListOn: html
 | fid mid idScnCnt mid2 |
 fid := html nextId.
 mid := html nextId.
 idScnCnt := html nextId.
 mid2 := html nextId.
 (html div)
  class: 'label';
  with: 'Nested Multi-Select-List'.
 (html div)
  class: 'control';
  with:
    [(html form)
     id: fid;
     with:
       [ "Master Multi-Select-List"
         html select
        size: 9;
        beMultiple;
        list: (1 to: 22);
        selected: mutliSelectList;
        callback: [:value | mutliSelectList := value];
        onChange: ((html updater)
           id: mid;
           triggerForm: fid;
           callback: [:r | r render: mutliSelectList]);
    
        onChange:( html updater
         id:  idScnCnt;
                     triggerForm: fid;
                     callback: [ :r |     "in this point create Slave Multi-Select-List in second case when Master change"
                                
               r render: scnCnt.  ]).

       (html div)
        class: 'model';
        id: mid;
        with: mutliSelectList.
       
         "  create Slave Multi-Select-List before Master Multi-Select-List change "

         scnCnt:=  html select id: idScnCnt;
                 size: 9;
                beMultiple; 
                list: mutliSelectList;
                 selected: mutliSelectList2;
                callback: [ :value | mutliSelectList2 := value ];
               onChange: (html updater
                     id: mid2;
                     triggerForm: fid;
                     callback: [ :r | r render: mutliSelectList2  ]).
     html div class: 'model'; id: mid2; with: mutliSelectList2.
    ].
 
 ].
 
My problem is , when change the Master Multi-Select-List the Slave Multi-Select-List is not update.
 
I have note after change the Master Multi-Select-List  and i select the Toggle Halos link the " Slave Multi-Select-List" is correct update.
 
Where i mistake ?
 

Any pointers would be greatly appreciated!

Thanks!

Dario Trussardi Romano.

 

I have do another solution where the Slave Multi-Select-List is create then the Master Multi-Select-List selection change.

In this case all functions but when i select the Toggle Halos link the Slave Multi-Select-List is lose.

Is this correct operation ?

 
 
 
 
 
 

_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Nested Multi-Select-List.

Lukas Renggli
>          "  create Slave Multi-Select-List before Master Multi-Select-List
> change "
>
>          scnCnt:=  html select id: idScnCnt;
>                  size: 9;
>                 beMultiple;
>                 list: mutliSelectList;
>                  selected: mutliSelectList2;
>                 callback: [ :value | mutliSelectList2 := value ];
>                onChange: (html updater
>                      id: mid2;
>                      triggerForm: fid;
>                      callback: [ :r | r render: mutliSelectList2  ]).
>      html div class: 'model'; id: mid2; with: mutliSelectList2.
>     ].
>
>  ].

That's not the way Seaside works. You cannot instantiate tags and
reuse them multiple times in different rendering contexts.

So to make your example works you need to split you code into multiple
rendering methods. This is good practice anyway, it is painful trying
to understand the code when written in one huge method like this. So
instead of

     scnCnt:=  html select id: idScnCnt;
          ....

you create a method that renders this part and call it from your
callback blocks.

Cheers,
Lukas

--
Lukas Renggli
http://www.lukas-renggli.ch
_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside