[Laszlo-user] Data updating question

James Howe openlaszlo at wingspread.imap-mail.com
Tue Apr 4 17:48:10 EDT 2006


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>

and a sample usage is like this:
	<dataset name="ds">
		<items>
			<item expiration="2"/>
		</items>
	</dataset>

	...
	<view datapath="ds:/items/item">
		<autoSelectingCombobox x="5" y="5" datapath="@expiration" width="130"  
editable="false">
			<textlistitem text="1 day"  value="1"/>
			<textlistitem text="2 days"  value="2"/>
			<textlistitem text="30 days" value="30"/>					
		</autoSelectingCombobox>
	</view>
	...

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.

Thanks!


-- 
James Howe


More information about the Laszlo-user mailing list