[Laszlo-dev] Expressions/Strings Conversion

Sarah Allen sallen at laszlosystems.com
Mon Jan 9 11:07:20 PST 2006


Hi Nik,

Using the brackets in Javascript can use a string to access a property.  
This should work:
var cellActive = pActive.name;
secondaryNavPath[cellActive].setAttribute("visible", false);

Sarah

nik bonaddio wrote:

> All,
>
> Nice to meet you. Long time listener, first time emailer. I'm no 
> Laszlo expert, so apologies in advance if my solution is obvious. I'm 
> working on some click/menu change functionality, where I have a level 
> of primary navigation and secondary navigation that is dependent on 
> what is clicked in the primary navigation. I'm trying to seperate it 
> to the point where I'm not relaying on hardcoding view paths. So what 
> I want to do is:
>
> var secondaryNavPath = canvas.bottom_button_wrapper;
>
> and then pass in an argument into a method
>
> <method name="handleClick" args="pActive, pClicked">
>
> so that I can simply call
>
> var cellActive = pActive.name;
> secondaryNavPath.cellActive
> .setAttribute("visible", false);
>
>
> However, this currently does not work because the pCell attribute is 
> currently a string, and can only be parsed into that statement (I'm 
> assuming here) if it is an expression. My idea is to pass in both the 
> current active cell and the cell that was clicked as arguments, and 
> then handle the rollover and show the necessary secondary navigation. 
> The logic is that I don't want to have to hardcode any paths into the 
> code. Anyone have any insight, or some code to convert string 
> variables to expressions?
>
>------------------------------------------------------------------------
>
>_______________________________________________
>Laszlo-dev mailing list
>Laszlo-dev at openlaszlo.org
>http://www.openlaszlo.org/mailman/listinfo/laszlo-dev
>  
>



More information about the Laszlo-dev mailing list