Hi everyone,

I'm running in a bit of trouble with some JDialogs.
I had a form where everytime you checked a checkbox an AJAX request
was sent and depending on the AJAX request result a JDialog was load
and everything was working just fine.
Now i was requested to add a 'Check all' checkbox. "Easy !" was what i
thought, since my AJAX request is sent on the checkbox 'change' event
i had the following code :
$j('#selectAll').click(function(){
                var bIsChecked = $j('#selectAll').attr('checked');
                if(canCountryBeChecked() == true)
                {
                        $j("form 
:checkbox[id^='cpyCountries_']").attr('checked',
bIsChecked);
                        $j("form 
:checkbox[id^='cpyCountries_']").trigger('change');
                }
                else
                {
                        loadSelectTypeAndContextFirstDialog();
                }
        });
As you can see i trigger the 'change' event when the checkbox is
programmatically checked or unchecked.

The trick comes here.

On every 'change' event i can see my AJAX request in firebug but i
noticed that not all the JDialogs that were supposed to be displayed
were actually displaying. Then i remember that my JDialogs had buttons
and those buttons were 'destroying' the JDialogs and since those
dialogs are using the same div id (since it's the same dialog with
some text changing depending on the selected checkbox) i thought that
if there were 2 JDialogs load at the same time instead of destroying
the one i was clicking on i was actually destroying both of them.

Am I wrong? If i'm not is there somebody who had this kind problem ?

PS : I'm using the stack:true option on JDialog

Thanks in advance for your help

Reply via email to