You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Marcos Chicote <mc...@newtechnologies.com.ar> on 2007/06/15 16:31:49 UTC

[T4] Question on TableRows

Hi!
I'm developing a page where I have a Form and a Table component (actually
Table component is not used, I use TableView, TableColumns, etc).
The idea is that when someone clicks on a TR of the table a JS function is
called and the form is filled with information about that row (so the user
can edit that row).

Here's the code I'm using:

    <component id="filasTabla" type="contrib:TableRows">
        <binding name="class" value="literal:textotabla"/>
        <binding name="element" value="literal:tr"/>
        <binding name="row" value="ognl:lpActual"/>
        <binding name="onclick" value="ognl:'javascript:fillForm(
                                                \' tableId \',
                                                \' 'lpActual.id' \',
<---------- Here's the problem!
                                                \' blablabla \',
                                                \' blablabla \',
                                                \' 1 \');'"/>
    </component>

However I keep getting a ognl.ParseException.
The problem is that I need to pass to the JS function parameters that I get
from the element being rendered by the TableRows component. How do I get
this done?
I'm using Tap 4.1.
I also tried this:
    <component id="filasTabla" type="contrib:TableRows">
        <binding name="class" value="literal:textotabla"/>
        <binding name="element" value="literal:tr"/>
        <binding name="onclick" value="ognl:'javascript:fillForm(
                                                \' tableId \',
                                                \' 'row.id' \', <----------
Here's the problem!
                                                \' blablabla \',
                                                \' blablabla \',
                                                \' 1 \');'"/>
    </component>


That didn't work either.

Thanks!
Marcos

Re: [T4] Question on TableRows

Posted by Marcos Chicote <to...@gmail.com>.
Thanks Jesse!
I was missing those "+" (concatenation).

Also, justo using row.id doesn't work. I had to bind TableRow's row
parameter to a page variable to make it work.
I added to the page file something like:

<binding name="row" value="thisLP"/>

and then used something like


"ognl:'StringValueInHere' + thisLP.id <http://row.id/> +
'moreStringValueStuff'"

because row.id throw a NoSuchPropertyException.

Thanks for the help!

Marcos.

On 6/18/07, Jesse Kuhnert <jk...@gmail.com> wrote:
>
> Use double quotes for your javascript function parameters?  Either that or
> try writing a javascript template via
> http://tapestry.apache.org/tapestry4.1/usersguide/script.html.
>
> Also, it's questionable whether or not you need to actually quote those
> characters at all.   Apart from that it looks like you are trying to do
> something like this:
>
> "ognl:'StringValueInHere\'referenceToObject\'moreStringStuff'"
>
> This is probably not going to work so well , but a much easier version
> that
> does work would be:
>
> "ognl:'StringValueInHere' + row.id + 'moreStringValueStuff'"
>
> On 6/15/07, Marcos Chicote <mc...@newtechnologies.com.ar> wrote:
> >
> > Hi!
> > I'm developing a page where I have a Form and a Table component
> (actually
> > Table component is not used, I use TableView, TableColumns, etc).
> > The idea is that when someone clicks on a TR of the table a JS function
> is
> > called and the form is filled with information about that row (so the
> user
> > can edit that row).
> >
> > Here's the code I'm using:
> >
> >     <component id="filasTabla" type="contrib:TableRows">
> >         <binding name="class" value="literal:textotabla"/>
> >         <binding name="element" value="literal:tr"/>
> >         <binding name="row" value="ognl:lpActual"/>
> >         <binding name="onclick" value="ognl:'javascript:fillForm(
> >                                                 \' tableId \',
> >                                                 \' 'lpActual.id' \',
> > <---------- Here's the problem!
> >                                                 \' blablabla \',
> >                                                 \' blablabla \',
> >                                                 \' 1 \');'"/>
> >     </component>
> >
> > However I keep getting a ognl.ParseException.
> > The problem is that I need to pass to the JS function parameters that I
> > get
> > from the element being rendered by the TableRows component. How do I get
> > this done?
> > I'm using Tap 4.1.
> > I also tried this:
> >     <component id="filasTabla" type="contrib:TableRows">
> >         <binding name="class" value="literal:textotabla"/>
> >         <binding name="element" value="literal:tr"/>
> >         <binding name="onclick" value="ognl:'javascript:fillForm(
> >                                                 \' tableId \',
> >                                                 \' 'row.id' \',
> > <----------
> > Here's the problem!
> >                                                 \' blablabla \',
> >                                                 \' blablabla \',
> >                                                 \' 1 \');'"/>
> >     </component>
> >
> >
> > That didn't work either.
> >
> > Thanks!
> > Marcos
> >
>
>
>
> --
> Jesse Kuhnert
> Tapestry/Dojo team member/developer
>
> Open source based consulting work centered around
> dojo/tapestry/tacos/hivemind. http://blog.opencomponentry.com
>

Re: [T4] Question on TableRows

Posted by Jesse Kuhnert <jk...@gmail.com>.
Use double quotes for your javascript function parameters?  Either that or
try writing a javascript template via
http://tapestry.apache.org/tapestry4.1/usersguide/script.html.

Also, it's questionable whether or not you need to actually quote those
characters at all.   Apart from that it looks like you are trying to do
something like this:

"ognl:'StringValueInHere\'referenceToObject\'moreStringStuff'"

This is probably not going to work so well , but a much easier version that
does work would be:

"ognl:'StringValueInHere' + row.id + 'moreStringValueStuff'"

On 6/15/07, Marcos Chicote <mc...@newtechnologies.com.ar> wrote:
>
> Hi!
> I'm developing a page where I have a Form and a Table component (actually
> Table component is not used, I use TableView, TableColumns, etc).
> The idea is that when someone clicks on a TR of the table a JS function is
> called and the form is filled with information about that row (so the user
> can edit that row).
>
> Here's the code I'm using:
>
>     <component id="filasTabla" type="contrib:TableRows">
>         <binding name="class" value="literal:textotabla"/>
>         <binding name="element" value="literal:tr"/>
>         <binding name="row" value="ognl:lpActual"/>
>         <binding name="onclick" value="ognl:'javascript:fillForm(
>                                                 \' tableId \',
>                                                 \' 'lpActual.id' \',
> <---------- Here's the problem!
>                                                 \' blablabla \',
>                                                 \' blablabla \',
>                                                 \' 1 \');'"/>
>     </component>
>
> However I keep getting a ognl.ParseException.
> The problem is that I need to pass to the JS function parameters that I
> get
> from the element being rendered by the TableRows component. How do I get
> this done?
> I'm using Tap 4.1.
> I also tried this:
>     <component id="filasTabla" type="contrib:TableRows">
>         <binding name="class" value="literal:textotabla"/>
>         <binding name="element" value="literal:tr"/>
>         <binding name="onclick" value="ognl:'javascript:fillForm(
>                                                 \' tableId \',
>                                                 \' 'row.id' \',
> <----------
> Here's the problem!
>                                                 \' blablabla \',
>                                                 \' blablabla \',
>                                                 \' 1 \');'"/>
>     </component>
>
>
> That didn't work either.
>
> Thanks!
> Marcos
>



-- 
Jesse Kuhnert
Tapestry/Dojo team member/developer

Open source based consulting work centered around
dojo/tapestry/tacos/hivemind. http://blog.opencomponentry.com