jQWidgets Forums

jQuery UI Widgets Forums Dialogs and Notifications Window Opening window 2nd time

This topic contains 5 replies, has 2 voices, and was last updated by  mr_putersmit 11 years, 1 month ago.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
  • Opening window 2nd time #52721

    mr_putersmit
    Participant

    Hi
    I have a very simple window and am calling the function from an onpress event in flexigrid. The window opens the first time, but on subsequent clicks, nothing happens. Is there some code I am missing to open the window on further clicks. Thanks

    flexigrid code

    {name: 'Help', bclass: 'help', onpress : helpWindow},

    window code

    function helpWindow() {
    	
            $("#jqxwindow").jqxWindow({ 
            	
            	height:'auto', 
            	width: 'auto', 
            	theme: 'darkblue', 
            	showCollapseButton: true, 
            	isModal: true 
            	
            	});
        }
    Opening window 2nd time #52750

    Dimitar
    Participant

    Hello mr_putersmit,

    The code in helpWindow initializes the grid and opens it. A second call to that function just re-sets the properties to the same values but does not open the window. We recommend that you execute the window initialization code just once in another part of your script and that you call only the window’s open method in helpWindow, i.e.:

    function helpWindow() {
        $('#jqxwindow').jqxWindow('open');
    }

    Best Regards,
    Dimitar

    jQWidgets team
    http://www.jqwidgets.com/

    Opening window 2nd time #52771

    mr_putersmit
    Participant

    Dimitar

    Thanks for reply. I am not quite sure I follow your answer. The amended code I have posted. is that correct? I didn’t think you could have 2 functions with the same name. Thanks

    function helpWindow() {
    	
            $("#jqxwindow").jqxWindow({ 
            	
            	height:'auto', 
            	width: 'auto', 
            	theme: 'darkblue', 
            	showCollapseButton: true, 
            	isModal: true 
            	
            	});
        }
    
    function helpWindow() {
        $('#jqxwindow').jqxWindow('open');
    }
    Opening window 2nd time #52775

    Dimitar
    Participant

    Hi mr_putersmit,

    As I said in my previous post, we recommend that you execute the window initialization code just once in another part of your script. This does not mean the helpWindow function. You can even do it on $(document).ready(), but you would have to set the autoOpen property to false then.

    Best Regards,
    Dimitar

    jQWidgets team
    http://www.jqwidgets.com/

    Opening window 2nd time #52779

    mr_putersmit
    Participant

    Dimitar

    I have taken your suggestion but if i set the autoOpen: false the window does not fire at all. In my external js files I have the code:

    function helpWindow() {
    	
    		$("#content").show();
            $("#jqxwindow").jqxWindow({ 
            	
            	height:'auto', 
            	width: 'auto', 
            	theme: 'summer', 
            	showCollapseButton: true, 
            	isModal: true,
            	animationType: 'fade',
            	autoOpen: false
            	
            	});
            	
        }

    and in my index.php page I have:

    <script type="text/javascript">
    $(function(){
       $('#jqxwindow').jqxWindow('open');
    });
    </script>

    where am I going wrong with this. Thanks

    Opening window 2nd time #52781

    mr_putersmit
    Participant

    Dimitar

    Thanks very much, but have now got it sorted. Many thanks for your help

Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.