[Laszlo-user] Data updating question

James Howe openlaszlo at wingspread.imap-mail.com
Wed Apr 5 15:07:01 EDT 2006


On Tue, 04 Apr 2006 17:48:10 -0400, James Howe  
<openlaszlo at wingspread.imap-mail.com> wrote:

> I've built a custom class which is used to automatically select items in  
> a combobox based on XML data.  The class looks like this:
>
> 	<class name="autoSelectingCombobox">
> 		<attribute name="editable" value="false" type="boolean"/>
> 		<attribute name="defaultplacement" value="_combo" type="string"/>
> 		<combobox name="_combo" width="${parent.width}"  
> editable="${parent.editable}" datapath="${parent.datapath}"/>
> 		<method event="ondata">
> 			_combo.selectItem(this.datapath.data);
> 		</method>
> 	</class>
>
> [...]
>
> Whenever the controlling XML changes, the combobox selection changes to  
> reflect the new value.  However, I want the user to be able to change  
> the value.  In the example above, when the user makes a new combobox  
> selection, I want the 'expiration' attribute in the XML to take on the  
> new value.  For regular components, this happens automatically when you  
> do an 'updateData()', but I'm not sure how to do things with my modified  
> component.
>

I found out how to do this by digging through the LZXReference.  It turns  
out that all I need to do is define an 'updateData' method on my class  
which looks like this:

<method name="updateData">
	return _combo.value;
</method>

Pretty simple, actually.  Just had to find the right place in the  
documentation to figure out what I needed to do.



-- 
James Howe


More information about the Laszlo-user mailing list