PDA

View Full Version : Newbie help


Samir
10-14-2004, 04:37 PM
Hi,

I recently started using laszlo and trying to build some prototypes. The problem I encountered while presenting data in tabular form. I attached the dataset with the view and it displays data correctly but what I wanted to evaluate node values and present them differently(like bgcolor, hiding some rows etc). Its pretty easy to do in traditional XSL based approach but couldn't figure out how to do that in Laszlo. Any help will be highly appreciated.

metasarah
10-15-2004, 04:48 AM
You could use $path binding
http://www.laszlosystems.com/lps-2.2/docs/guide/databinding.html#d0e16522
however XML data will always be a string, so if you want to access values that are numbers (like bgcolor) or boolean (like visible), so you could do:

<view colorstring="$path{'@mycolor'}" bgcolor="${parseInt(colorstring)"/>


or you can do it procedurally from the 'ondata' event, for example:


<view datapath="mydata:/root" layout="axis:y">
<text datapath="something">
<method event="ondata" args="d">
var mycolor = parseInt(this.datapath.data.attributes.mycolor);
var vis = this.datapath.data.attributes.visible == "true";
this.setAttribute('bgcolor', mycolor);
this.setAttribute('visible', vis);
</method>
</text>
</view>



The data documentation is a little sparse in this area. I hope this helps.

Sarah

Samir
10-17-2004, 04:20 PM
Hi Sarah,

Thanks for your reply. The Laszlo documentation is not little sparse but very vague at this front. I am wondering if same document set they used to give in case of official buyers earlier?

Anyway no doubt it is a great product(although no internationalization yet). BTW I haven't tried your solution yet but wouldn't it will be space alignment problem. Like what if I hide one complete row, won't it effect on line spacing?

Thanks
Samir

metasarah
10-17-2004, 04:46 PM
This release has more documentation than previous releases of our commercial product.

I don't really understand your follow-up question. In the previous message and example code there was nothing about hiding or showing rows of data or line spacing.

Sarah