PDA

View Full Version : Passing Complicated Objects as Attributes


ankushb
06-23-2005, 02:46 AM
Hi,
I have some problem as I have to pass a node object as attribute in laszlo. as like
<Treemap id="tree" root="node">

now root is not an array or a string.

How can i do that?

Thanks

hqm
06-23-2005, 04:57 AM
you can say foo="$once{some.complex.value.or.expression}"

or foo="${some constraint expression}"

Also, if you are making your own class, and you declare an attribute of a class to be of type "expression" (or don't declare a type at all) then it will compile into script which will evaluate the argument as an expression.


You can see what your lzx code translates to in javascript by running the standalone command line compiler

lzc --script yourfile.lzx

ankushb
06-23-2005, 05:03 AM
Hi,
i have to pass another data structue that i have created in java script i dont have to pass some expression.

tree ds is this

function Node(v,s,name,x,y,width,height, level,root)
{

this.value = v;
this.size = s;
this.name= name;
this.x = 0;
this.y = 0;
this.width = 400;
this.height = 400;
this.level = level ? level : 0;

this.child = [];
this.getchild = getchild;
this.isleaf = true;
this.root = root;
this.id = null;
this.getroot = null;


this.nextSibling = null;
this.previousSibling = null;
this.addNode = addNode;
this.countNodes = countNodes;
this.sort1 = sort1;
this.genid = genid;

if(root == true)
{
this.parent = null;
this.id = "idl"
this.getroot = this;
}
}


function getchild()
{
return this.child;
}


function addNode(v,s,name)
{
this.isleaf = false;
var sibIndex = this.child.length;
this.child[sibIndex] = new Node(v,s,name,0,0,0,0, this.level+1,false);
this.child[sibIndex].parent = this;
this.child[sibIndex].isleaf = true;
this.child[sibIndex].getroot = this.getroot;
var a = sibIndex + "";
this.child[sibIndex].id = this.id + a + "l";

if(sibIndex > 0)
{
this.child[sibIndex].previousSibling = this.child[sibIndex-1];
this.child[sibIndex -1].nextSibling = this.child[sibIndex];
}

return this.child[sibIndex];
}