[Seaside] JQDialog button problems

Robert Sirois watchlala at hotmail.com
Tue Jan 24 14:43:08 UTC 2012


You can chain in jQuery. Otherwise, I'm a big fan of doing an ajax request and passing a function to the #onSuccess: event of it. For example:
(this code isn't tested, so I may make a couple mistakes)
...#addButton: ( (html jQuery ajax script: [:s | s add: (self thisFunctionDoesSomethingServersideAndUpdatesADivOn: s) ] ) onSuccess: ( html jQuery new dialog close ) ).
...
Hope that helps,RS
Date: Tue, 24 Jan 2012 09:06:49 +0100
From: malte.grunwald at googlemail.com
To: seaside at lists.squeakfoundation.org
Subject: [Seaside] JQDialog  button problems


  



    
  
  
    Hey everybody,

    

    I have this problem for a while now and not found a solution until
    now.

    I already brought this up, a few months ago, some people tried to
    help me, but I did not found a solution.

    

    I will use a JQDialog with multiple buttons, i.e. "cancel" and
    "confirm".

    The cancel button should only close the window. 

    No problem so far.

    But now the tricky part, the "confirm" button should serialize a
    form, send an ajax request to update a div container and then close
    the window.

    

    My problem is, I am not able to attach more than one method to a
    button.

    

    Here my example dialog:

    

    (html div)

                id: anIdString;

                script: (((html jQuery id: anIdString) dialog)

                            title: (anIdString copyFrom: 4 to:
        anIdString size);

                            autoOpen: false;

                            modal: true;

                            width: anInteger;

                            height: 'auto';

                            resizable: false;

                            addButton: 'Close' do: html jQuery new
        dialog close);

                with: [self dialogContent: html]

    

    This is a suggestion, Jan van de Sandt made. Thanks again.

    

    testButtons: html

    
     ^
          OrderedCollection new
    
      
    
          add: (Dictionary new
    
          at: 'id' put: html nextId ;
    
          at: 'text' put: 'Annuleer' ;
    
      
    
          at: 'click' put: (html jQuery ajax script: [ :h | self
          actionCancel: h ]) asFunction ;
    
          yourself) ;
    
      
     add: (Dictionary new
    
          at: 'id' put: html nextId ;
    
          at: 'text' put: 'Ok' ;
    
      
    
          at: 'click' put: (html jQuery ajax 
    
          serializeForm: (html jQuery id: self personDataFormId)
          ;
    
      
    
          script: [ :s | self actionFinish: s ]) asFunction ;
    
          yourself) ;
    
          asArray

          

          

        

      (html div)

                  id: anIdString;

                  script: (((html jQuery id: anIdString) dialog)

                              title: (anIdString copyFrom: 4 to:
          anIdString size);

                              autoOpen: false;

                              modal: true;

                              width: anInteger;

                              height: 'auto';

                              resizable: false;

                              addButton: 'Close' do: html jQuery new
          dialog close);

                              buttons: (self testButtons: html);

                  with: [self dialogContent: html]

      

          

        But this did not work for
              me.

              Maybe somebody have an idea.

              

              Thank you very much!

              

              Kind regards 

              

              Malte

          
    

  


_______________________________________________
seaside mailing list
seaside at lists.squeakfoundation.org
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/seaside/attachments/20120124/66ade63b/attachment.htm


More information about the seaside mailing list