PDA

View Full Version : Problems w/ dot-annotation in custom attributes


johncorro
11-03-2004, 10:03 AM
I've created a subclass to dataset (rpcdataset) that has two custom attributes: "controller" and "method". When I attempt to create a new instance of rpcdataset, I'll pass in a dot-annotated value for the controller attribute.

<rpcdataset controller="com.foo.bar" method="bah"/>

When I do this, though, Laszlo complains that "com" and "foo" are undefined and that it can't find attributes "foo" and "bar" on them (respectively). However, when I changed my code to

<rpcdataset controller="${'com.foo.bar'}" .../>
everything seems to work fine.

Does anyone know why this is? I'd like to not be forced to have to wrap all my controller values in ${''} if at all possible.

I've tried the solution posted at
http://www.laszlosystems.com/developers/community/forums/showthread.php?s=&threadid=936&highlight=dot
but it doesn't seem to work. Any help would be appreciated.

pablo
11-11-2004, 12:06 PM
Hi John,

Attributes default to an expression type. To ensure that your type is a string, you need to declare it like:


<attribute name="controller" type="string" />


Another way of setting your controller to string is:


<rpcdataset controller="'com.foo.bar'" .../>


That is equivalent to this:


<rpcdataset controller="$once{'com.foo.bar'}" .../>


Hope this helps.

pablo