adding close event handler to dialog

15 views
Skip to first unread message

Ivano Luberti

unread,
Feb 24, 2015, 3:08:28 AM2/24/15
to tapestry...@googlegroups.com
Hi, I have a dialog


    <t:jquery.dialog t:clientId="obliterazioniDialog">

        <t:zone t:id="dialogZone" id="dialogZone">
           
            <span t:type="grid" source="obliterazioni" model="obliterazioniModel">
            </span>
                       
        </t:zone>               
   
    </t:jquery.dialog>


And I open it using

<t:jquery.dialogajaxlink t:id="openObliterazioniDialog" t:dialog="obliterazioniDialog" t:zone="dialogZone" t:context="itemOrdine.numBiglietto" >
                        <button class="btn btn-primary">${message:visualizzaOblterazioni}</button>
 </t:jquery.dialogajaxlink>

It works properly.
Now I want to add an handler for the dialog so that when it is closed another control in the page get the focus.
I have added a js file to the page using

@Import(library={"context:layout/js/barcode.js"})

in the page class.
Here is my javascript


$(function() {
    
    $(document).ready(function() {
         $("#barcode").val("");
                 
         $( "#obliterazioniDialog" ).on( "dialogclose",
                
                 function( event, ui ) {
                     console.log("close fired");
                     $( "#barcode" ).focus();
         } );
        
    });
    
});


You see there is a first jquery statement that empties a value and that works.
Then there is the statement to add the vent handler.
Now using firebug I see the event is added and that #obliterazioniDialog exists but then closing the dialog the event is not fired.

Any suggestion?
-- 
==================================================
dott. Ivano Mario Luberti
Archimede Informatica societa' cooperativa a r. l.
Sede Operativa
Via Gereschi 36 - 56126- Pisa
tel.: +39-050- 580959
tel/fax: +39-050-9711344
web: www.archicoop.it
==================================================
Reply all
Reply to author
Forward
0 new messages