Re: [S2] Change updateFreq in a DIV

2007-11-07 Thread Grish

I did what you suggested and i saw the setInterval() function; which works!

Thanks for pointing me to the right direction and the learning experience!


Jeromy Evans - Blue Sky Minds wrote:
> 
> Grish wrote:
>> So I ended up with the following code:
>>
>> var myDiv = dojo.widget.byId("myDivId");
>> myDiv.timer.interval = newInterval;
>>
>>   
> Great!
>> Also you need to restart the timer by stopping it and starting again for
>> the
>> new interval to take effect. Would there be some kind of function I can
>> use
>> to change the interval or this is the only way?
>>
>>   
> Not sure, you know more about it than I do now.  If the div is using the 
> standard dojo timer (dojo.lang.timing.Timer) you should have access to 
> the setInterval(interval) method that looks like it will work while the 
> timer's running. 
> 
> myDiv.timer.setInterval(newInterval);
> 
> As with members, public methods should be browsable in Firebug.
> 
> If it is/extends a dojo timer, take a quick look at the implementation 
> in: 
> struts2-core-xxx.jar!/org/apache/struts2/static/dojo/src/lang/timing/Timer.js
> 
>>
>> Jeromy Evans - Blue Sky Minds wrote:
>>   
>>> Your code references "quoteDetails" but the div you provided is 
>>> "myDivId".  Other than that I don't see anything wrong with it. 
>>> updateFreq should be writeable using your approach although I haven't 
>>> tried it.
>>>
>>> Try a simple script:
>>>
>>>  var myWidget = dojo.widget.byId("myDivId");
>>>   myWidget.updateFreq = 10;
>>>
>>> Use a breakpoint in FireBug to ensure the widget is found and that the 
>>> updateFreq member is public.
>>>
>>> Hope that helps,
>>> Jeromy Evans
>>>
>>> Grish wrote:
>>> 
 Ok I've made some progress but now i'm stuck. What I did was have a a
 div
 tag

  >>>   showLoadingText="false" updateFreq="5000" autoStart="false" 
   startTimerListenTopics="/startTimer"
 stopTimerListenTopics="/stopTimer" />

 then I have select box 

 >>> />

 then on my updateFreq function i have the following:

 function updateFreq(obj) {
   
   
   if (obj.selectedIndex == 0) {
 dojo.event.topic.publish("/stopTimer");
   } 
   else {
 // get Div and update frequency
 var quoteDiv = dojo.byId("quoteDetails");
 quoteDiv.updateFreq = obj.options[obj.selectedIndex].value;
 dojo.event.topic.publish("/startTimer");
   }
   
 }

 Right now everything is working except the change to the updateFreq.
 When
 the timer starts it still keeps with the 5 second interval Is it
 possible
 to
 access this property and change it?



 Grish wrote:
   
   
> Hi,
>
> I'm having a hard time trying to implement this - I want to have a
> select
> box containing options for the user to select the update frequency of
> my
> div tag. So my select box has "no refresh", "30 seconds", "60
> seconds",
> "120 seconds" and depending on what the user selects the frequency
> will
> change. 
>
> I was thinking i could make a topic to change the updateFreq parameter
> then with the onchange event with the select tag i'll make a call for
> that
> topic:
>
> dojo.event.topic.subscribe("/changeRefresh", function(data, type,
> request)
> {
>   // code to change the updateFreq of the div tag
> }
>
>  onchange="onchange="dojo.event.topic.publish('/changeRefresh')"
> ..
>
> I just don't know how to access the div tag and change the updateFreq
> parameter. I tried using the dojo.byId("myDivId") function but it
> didn't
> work. Suggestion on how to do this?
>
> Also just curious as to why there's no type variable when i call my
> topic
> from an event like onchange, it's always undefined. 
>
> 
> 
   
   
>>> -
>>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>>> For additional commands, e-mail: [EMAIL PROTECTED]
>>>
>>>
>>>
>>> 
>>
>>   
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Triggering-topics-tf4722712.html#a13642168
Sent from the Struts - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [S2] Change updateFreq in a DIV

2007-11-07 Thread Jeromy Evans

Grish wrote:

So I ended up with the following code:

var myDiv = dojo.widget.byId("myDivId");
myDiv.timer.interval = newInterval;

  

Great!

Also you need to restart the timer by stopping it and starting again for the
new interval to take effect. Would there be some kind of function I can use
to change the interval or this is the only way?

  
Not sure, you know more about it than I do now.  If the div is using the 
standard dojo timer (dojo.lang.timing.Timer) you should have access to 
the setInterval(interval) method that looks like it will work while the 
timer's running. 


myDiv.timer.setInterval(newInterval);

As with members, public methods should be browsable in Firebug.

If it is/extends a dojo timer, take a quick look at the implementation 
in: 
struts2-core-xxx.jar!/org/apache/struts2/static/dojo/src/lang/timing/Timer.js




Jeromy Evans - Blue Sky Minds wrote:
  
Your code references "quoteDetails" but the div you provided is 
"myDivId".  Other than that I don't see anything wrong with it. 
updateFreq should be writeable using your approach although I haven't 
tried it.


Try a simple script:

 var myWidget = dojo.widget.byId("myDivId");
  myWidget.updateFreq = 10;

Use a breakpoint in FireBug to ensure the widget is found and that the 
updateFreq member is public.


Hope that helps,
Jeromy Evans

Grish wrote:


Ok I've made some progress but now i'm stuck. What I did was have a a div
tag

   showLoadingText="false" updateFreq="5000" autoStart="false" 
  startTimerListenTopics="/startTimer"

stopTimerListenTopics="/stopTimer" />

then I have select box 




then on my updateFreq function i have the following:

function updateFreq(obj) {
  
  
  if (obj.selectedIndex == 0) {

dojo.event.topic.publish("/stopTimer");
  } 
  else {

// get Div and update frequency
var quoteDiv = dojo.byId("quoteDetails");
quoteDiv.updateFreq = obj.options[obj.selectedIndex].value;
dojo.event.topic.publish("/startTimer");
  }
  
}


Right now everything is working except the change to the updateFreq. When
the timer starts it still keeps with the 5 second interval Is it possible
to
access this property and change it?



Grish wrote:
  
  

Hi,

I'm having a hard time trying to implement this - I want to have a
select
box containing options for the user to select the update frequency of my
div tag. So my select box has "no refresh", "30 seconds", "60 seconds",
"120 seconds" and depending on what the user selects the frequency will
change. 


I was thinking i could make a topic to change the updateFreq parameter
then with the onchange event with the select tag i'll make a call for
that
topic:

dojo.event.topic.subscribe("/changeRefresh", function(data, type,
request)
{
  // code to change the updateFreq of the div tag
}

from an event like onchange, it's always undefined. 



  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]






  



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [S2] Change updateFreq in a DIV

2007-11-07 Thread Grish

Thanks for the reply!

Sorry about the example, the references were indeed wrong in my example but
the code was using the right references. My problem was when I would refer
to myDiv.updateFreq it would be undefined. But when I used your simple
script I was able to get the div widget and access the updateFreq. 

But it turned out that even if i changed the updateFreq my refresh interval
wouldn't work. So I took your advice and did a watch using firebug and
discovered there was a timer object and an interval property. Turns out
that's the one you have to modify.

So I ended up with the following code:

var myDiv = dojo.widget.byId("myDivId");
myDiv.timer.interval = newInterval;

Also you need to restart the timer by stopping it and starting again for the
new interval to take effect. Would there be some kind of function I can use
to change the interval or this is the only way?

Thanks again for the reply!



Jeromy Evans - Blue Sky Minds wrote:
> 
> Your code references "quoteDetails" but the div you provided is 
> "myDivId".  Other than that I don't see anything wrong with it. 
> updateFreq should be writeable using your approach although I haven't 
> tried it.
> 
> Try a simple script:
> 
>  var myWidget = dojo.widget.byId("myDivId");
>   myWidget.updateFreq = 10;
> 
> Use a breakpoint in FireBug to ensure the widget is found and that the 
> updateFreq member is public.
> 
> Hope that helps,
> Jeromy Evans
> 
> Grish wrote:
>> Ok I've made some progress but now i'm stuck. What I did was have a a div
>> tag
>>
>>  >   showLoadingText="false" updateFreq="5000" autoStart="false" 
>>   startTimerListenTopics="/startTimer"
>> stopTimerListenTopics="/stopTimer" />
>>
>> then I have select box 
>>
>> 
>>
>> then on my updateFreq function i have the following:
>>
>> function updateFreq(obj) {
>>   
>>   
>>   if (obj.selectedIndex == 0) {
>> dojo.event.topic.publish("/stopTimer");
>>   } 
>>   else {
>> // get Div and update frequency
>> var quoteDiv = dojo.byId("quoteDetails");
>> quoteDiv.updateFreq = obj.options[obj.selectedIndex].value;
>> dojo.event.topic.publish("/startTimer");
>>   }
>>   
>> }
>>
>> Right now everything is working except the change to the updateFreq. When
>> the timer starts it still keeps with the 5 second interval Is it possible
>> to
>> access this property and change it?
>>
>>
>>
>> Grish wrote:
>>   
>>> Hi,
>>>
>>> I'm having a hard time trying to implement this - I want to have a
>>> select
>>> box containing options for the user to select the update frequency of my
>>> div tag. So my select box has "no refresh", "30 seconds", "60 seconds",
>>> "120 seconds" and depending on what the user selects the frequency will
>>> change. 
>>>
>>> I was thinking i could make a topic to change the updateFreq parameter
>>> then with the onchange event with the select tag i'll make a call for
>>> that
>>> topic:
>>>
>>> dojo.event.topic.subscribe("/changeRefresh", function(data, type,
>>> request)
>>> {
>>>   // code to change the updateFreq of the div tag
>>> }
>>>
>>> >> onchange="onchange="dojo.event.topic.publish('/changeRefresh')"
>>> ..
>>>
>>> I just don't know how to access the div tag and change the updateFreq
>>> parameter. I tried using the dojo.byId("myDivId") function but it didn't
>>> work. Suggestion on how to do this?
>>>
>>> Also just curious as to why there's no type variable when i call my
>>> topic
>>> from an event like onchange, it's always undefined. 
>>>
>>> 
>>
>>   
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Triggering-topics-tf4722712.html#a13640865
Sent from the Struts - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [S2] Change updateFreq in a DIV

2007-11-07 Thread Martin Gainty
dojo onchange function is inlined
in other words as soon as it is declared a function is assigned to
accomplish the event e.g.
 "onchange", function (e) {
 if ($("toggleSelection").checked) {
  dojo.html.disableSelection($("enabletest"));
 } else {
  dojo.html.enableSelection($("enabletest"));
 }
}

Struts setting of type

Martin--
- Original Message -
From: "Jeromy Evans" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" 
Sent: Wednesday, November 07, 2007 7:52 AM
Subject: Re: [S2] Change updateFreq in a DIV


> Your code references "quoteDetails" but the div you provided is
> "myDivId".  Other than that I don't see anything wrong with it.
> updateFreq should be writeable using your approach although I haven't
> tried it.
>
> Try a simple script:
>
>  var myWidget = dojo.widget.byId("myDivId");
>   myWidget.updateFreq = 10;
>
> Use a breakpoint in FireBug to ensure the widget is found and that the
> updateFreq member is public.
>
> Hope that helps,
> Jeromy Evans
>
> Grish wrote:
> > Ok I've made some progress but now i'm stuck. What I did was have a a
div tag
> >
> >   >   showLoadingText="false" updateFreq="5000" autoStart="false"
> >   startTimerListenTopics="/startTimer"
> > stopTimerListenTopics="/stopTimer" />
> >
> > then I have select box
> >
> > 
> >
> > then on my updateFreq function i have the following:
> >
> > function updateFreq(obj) {
> >
> >
> >   if (obj.selectedIndex == 0) {
> > dojo.event.topic.publish("/stopTimer");
> >   }
> >   else {
> > // get Div and update frequency
> > var quoteDiv = dojo.byId("quoteDetails");
> > quoteDiv.updateFreq = obj.options[obj.selectedIndex].value;
> > dojo.event.topic.publish("/startTimer");
> >   }
> >
> > }
> >
> > Right now everything is working except the change to the updateFreq.
When
> > the timer starts it still keeps with the 5 second interval Is it
possible to
> > access this property and change it?
> >
> >
> >
> > Grish wrote:
> >
> >> Hi,
> >>
> >> I'm having a hard time trying to implement this - I want to have a
select
> >> box containing options for the user to select the update frequency of
my
> >> div tag. So my select box has "no refresh", "30 seconds", "60 seconds",
> >> "120 seconds" and depending on what the user selects the frequency will
> >> change.
> >>
> >> I was thinking i could make a topic to change the updateFreq parameter
> >> then with the onchange event with the select tag i'll make a call for
that
> >> topic:
> >>
> >> dojo.event.topic.subscribe("/changeRefresh", function(data, type,
request)
> >> {
> >>   // code to change the updateFreq of the div tag
> >> }
> >>
> >>  >> ..
> >>
> >> I just don't know how to access the div tag and change the updateFreq
> >> parameter. I tried using the dojo.byId("myDivId") function but it
didn't
> >> work. Suggestion on how to do this?
> >>
> >> Also just curious as to why there's no type variable when i call my
topic
> >> from an event like onchange, it's always undefined.
> >>
> >>
> >
> >
>
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [S2] Change updateFreq in a DIV

2007-11-07 Thread Jeromy Evans
Your code references "quoteDetails" but the div you provided is 
"myDivId".  Other than that I don't see anything wrong with it. 
updateFreq should be writeable using your approach although I haven't 
tried it.


Try a simple script:

var myWidget = dojo.widget.byId("myDivId");
 myWidget.updateFreq = 10;

Use a breakpoint in FireBug to ensure the widget is found and that the 
updateFreq member is public.


Hope that helps,
Jeromy Evans

Grish wrote:

Ok I've made some progress but now i'm stuck. What I did was have a a div tag

   showLoadingText="false" updateFreq="5000" autoStart="false" 
  startTimerListenTopics="/startTimer"

stopTimerListenTopics="/stopTimer" />

then I have select box 




then on my updateFreq function i have the following:

function updateFreq(obj) {
  
  
  if (obj.selectedIndex == 0) {

dojo.event.topic.publish("/stopTimer");
  } 
  else {

// get Div and update frequency
var quoteDiv = dojo.byId("quoteDetails");
quoteDiv.updateFreq = obj.options[obj.selectedIndex].value;
dojo.event.topic.publish("/startTimer");
  }
  
}


Right now everything is working except the change to the updateFreq. When
the timer starts it still keeps with the 5 second interval Is it possible to
access this property and change it?



Grish wrote:
  

Hi,

I'm having a hard time trying to implement this - I want to have a select
box containing options for the user to select the update frequency of my
div tag. So my select box has "no refresh", "30 seconds", "60 seconds",
"120 seconds" and depending on what the user selects the frequency will
change. 


I was thinking i could make a topic to change the updateFreq parameter
then with the onchange event with the select tag i'll make a call for that
topic:

dojo.event.topic.subscribe("/changeRefresh", function(data, type, request)
{
  // code to change the updateFreq of the div tag
}

from an event like onchange, it's always undefined. 




  



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



[S2] Change updateFreq in a DIV

2007-11-06 Thread Grish

Ok I've made some progress but now i'm stuck. What I did was have a a div tag

 

then I have select box 



then on my updateFreq function i have the following:

function updateFreq(obj) {
  
  
  if (obj.selectedIndex == 0) {
dojo.event.topic.publish("/stopTimer");
  } 
  else {
// get Div and update frequency
var quoteDiv = dojo.byId("quoteDetails");
quoteDiv.updateFreq = obj.options[obj.selectedIndex].value;
dojo.event.topic.publish("/startTimer");
  }
  
}

Right now everything is working except the change to the updateFreq. When
the timer starts it still keeps with the 5 second interval Is it possible to
access this property and change it?



Grish wrote:
> 
> Hi,
> 
> I'm having a hard time trying to implement this - I want to have a select
> box containing options for the user to select the update frequency of my
> div tag. So my select box has "no refresh", "30 seconds", "60 seconds",
> "120 seconds" and depending on what the user selects the frequency will
> change. 
> 
> I was thinking i could make a topic to change the updateFreq parameter
> then with the onchange event with the select tag i'll make a call for that
> topic:
> 
> dojo.event.topic.subscribe("/changeRefresh", function(data, type, request)
> {
>   // code to change the updateFreq of the div tag
> }
> 
>  ..
> 
> I just don't know how to access the div tag and change the updateFreq
> parameter. I tried using the dojo.byId("myDivId") function but it didn't
> work. Suggestion on how to do this?
> 
> Also just curious as to why there's no type variable when i call my topic
> from an event like onchange, it's always undefined. 
> 

-- 
View this message in context: 
http://www.nabble.com/Triggering-topics-tf4722712.html#a13603045
Sent from the Struts - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]