PDA

View Full Version : Open window with hyperlink



Achim74
6 Feb 2010, 2:38 PM
Hi,

I have a problem with the following:



<script>
Ext.onReady(function() {
Ext.QuickTips.init();
var CalendarWindow = ... my Ext.Window.constructor stuff ....

// this works
CalendarWindow.show()

});
</script>

<!-- This does not work-->
<a href="javascript:CalendarWindow.show();">Show</a>
<div id="calendar_table"></div>
I guess I have a elementar understanding problem. Can anyone give me a hin how to make the hyperlink work ? How can I open the CalendarWindow outside of Ext.onReady ?

Thank you .. Greetings

oaugustus
7 Feb 2010, 3:55 AM
That is very simple. This behavior is because javascript scope. To do this code work make:


<script>
var CalendarWindow;
Ext.onReady(function() {
Ext.QuickTips.init();
CalendarWindow = ... my Ext.Window.constructor stuff ....

// this works
CalendarWindow.show()

});
</script>

<!-- Now this work-->
<a href="#" onclick="CalendarWindow.show();">Show</a>
<div id="calendar_table"></div>

Achim74
8 Feb 2010, 11:48 AM
Thank you .. my mistake. worked perfect