[Dojo-interest] Reparse a widget

Rose, Ryan RRose at nerac.com
Wed Dec 6 07:54:54 MST 2006


Have you tried putting the page elements that are refreshed into a
ContentPane with parseContent="true"? According to the code, this should
construct all widgets that are in the content. You can use some css to
make the ContentPane look transparent to the user. 

You can also look at the source for ContentPane and mimic what it does
to accomplish this.

Regards,
Ryan Rose
Digiwize.com

-----Original Message-----
From: dojo-interest-bounces at dojotoolkit.org
[mailto:dojo-interest-bounces at dojotoolkit.org] On Behalf Of Gregary
Hendricks
Sent: Tuesday, December 05, 2006 8:18 PM
To: dojo-interest at dojotoolkit.org
Subject: [Dojo-interest] Reparse a widget

Hi folks,

I am having some trouble with a ComboBox widget. Here is how it works:

1. Page loads with my combobox. The combobox is parsed and rendered as
such.
2. User selects something from the combobox. (This part is working fine)
3. This fires the onValueChanged event which calls a io.bind call that
gets some data and refreshes a portion of the page. 

The problem is that the combo box itself is on the part of the page that
gets refreshed. This is what my widget looks like: 

<input dojoType="combobox" 
   dataUrl="tr_quicksearch.cgi?action=get&search=%{searchString}" 
   mode="remote"
   autoComplete="false"
   id="env_[% index %]"
   maxListLength="10"
   onValueChanged='chEnv([% index %], this.comboBoxSelectionValue.value,
"[% caserun.status %]", [% caserun.id %], [% caserun.environment_id
%])'>

The stuff inside of [% %] is Perl template that gets parsed out and
replaced with the proper values.

When this renders on the refreshed portion of the page, it renders as a
regular input box since the parsing of the widgets only happens when the
whole page is refreshed. My question is this, is it possible to just
re-render this widget programmatically?

I have tried using the dojo.widget.createWidget which works fine until I
get to the part where I define the onValueChanged attribute. It seems to
ignore it. This means that even though the widget would render, it is
now useless since it does not fire off the script that needs to be
activated when the user makes a second selection.

Perhaps there is some way to make CreateWidget attach the onValueChanged
event? It think though the easiest thing would be to just reparse that
widget since it is already defined as I want it.

Please assist.
Thank you.

Greg

_______________________________________________
Dojo FAQ: http://dojo.jot.com/FAQ
Dojo Book: http://manual.dojotoolkit.org/DojoDotBook
Dojo-interest at dojotoolkit.org
http://dojotoolkit.org/mailman/listinfo/dojo-interest


More information about the Dojo-interest mailing list