You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Nima Boustanian <ni...@tn20.com> on 2006/03/21 18:41:09 UTC
returning a list containing strings and lists in OGNL
Hey all
I have two columns in my contrib:table, one returns a string and the
other one returns a list.
<table jwcid="table@contrib:Table"
cellpadding="0"
width="100%"
class="myTable"
source="ognl:table"
columns="testString, testList.name"
pageSize="5"
pagesDisplayed="2"/>
I manage to extract the string with the above line, but the testList
which contains objects with getName methods (that return strings)
is a bit trickier. I have tried testList.name but without luck, can
someone please give me some pointers on how this
should be done?
Thanks!
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: returning a list containing strings and lists in OGNL
Posted by Mike Snare <mi...@gmail.com>.
As an aside, it doesn't actually have to go *in* the table element in
the component. It can go anywhere in the template...
-Mike
On 3/21/06, Mike Snare <mi...@gmail.com> wrote:
> You need to use a Block to render that column. Simply change
> testList.name back to testList and include the following inside the
> table element in your template:
>
> <span jwcid="testListColumnValue@Block">
> <span jwcid="@Insert" value="ognl:components.table.tableRow.name" />
> </span>
>
> the Table component will use this block to render the data in the
> testList column instead of the standard rendering.
>
> On 3/21/06, Nima Boustanian <ni...@tn20.com> wrote:
> > Hey all
> >
> > I have two columns in my contrib:table, one returns a string and the
> > other one returns a list.
> >
> > <table jwcid="table@contrib:Table"
> > cellpadding="0"
> > width="100%"
> > class="myTable"
> > source="ognl:table"
> > columns="testString, testList.name"
> > pageSize="5"
> > pagesDisplayed="2"/>
> >
> > I manage to extract the string with the above line, but the testList
> > which contains objects with getName methods (that return strings)
> > is a bit trickier. I have tried testList.name but without luck, can
> > someone please give me some pointers on how this
> > should be done?
> >
> > Thanks!
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> >
> >
>
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: returning a list containing strings and lists in OGNL
Posted by Mike Snare <mi...@gmail.com>.
I don't follow.
Is there a getTestList() method in the objects contained by the
getTable() method of your page? If not, then your code won't work.
The code you and I both wrote assumes that testList is an member of
the items being iterated by the table.
If, instead, you want to display something not accessible to the
object in the row AND you dont want to use the Block you need to use
the '=' syntax for the column definition. Seems easier to use the
block though.
Instead of columns="testString, testList.name"
try
columns="testString, =testName"
where testName is some ognl expression that evaluates to an ITableColumn.
Check out the docs for TableView.
http://jakarta.apache.org/tapestry/tapestry-contrib/ComponentReference/TableView.html
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: returning a list containing strings and lists in OGNL
Posted by Nima Boustanian <ni...@tn20.com>.
But Mike - If I type
<span jwcid="testListColumnValue@Block">
<span jwcid="@Insert" value="ognl:components.table.tableRow.name" />
</span>
It will take me to the actual MyTable class, and that class doesn't have a getName method, it only
has a method which returns the testList. Do I have to make a separate @For loop to iterate over the
specific objects for this and then do a @Insert? ...sort of like this:
<span jwcid="relatedTagsColumnValue@Block">
<span jwcid="@For" source="ognl:testList" value="ognl:testObject">
<span jwcid="@Insert" value="ognl:testObject.name" />
</span>
</span>
I have done the above solution before but I'd rather not do it again
because it presents a bunch of other problems.
Thanks btw!
Mike Snare wrote:
>You need to use a Block to render that column. Simply change
>testList.name back to testList and include the following inside the
>table element in your template:
>
><span jwcid="testListColumnValue@Block">
> <span jwcid="@Insert" value="ognl:components.table.tableRow.name" />
></span>
>
>the Table component will use this block to render the data in the
>testList column instead of the standard rendering.
>
>On 3/21/06, Nima Boustanian <ni...@tn20.com> wrote:
>
>
>>Hey all
>>
>>I have two columns in my contrib:table, one returns a string and the
>>other one returns a list.
>>
>><table jwcid="table@contrib:Table"
>> cellpadding="0"
>> width="100%"
>> class="myTable"
>> source="ognl:table"
>> columns="testString, testList.name"
>> pageSize="5"
>> pagesDisplayed="2"/>
>>
>>I manage to extract the string with the above line, but the testList
>>which contains objects with getName methods (that return strings)
>>is a bit trickier. I have tried testList.name but without luck, can
>>someone please give me some pointers on how this
>>should be done?
>>
>>Thanks!
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>
>>
>>
>>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: returning a list containing strings and lists in OGNL
Posted by Mike Snare <mi...@gmail.com>.
You need to use a Block to render that column. Simply change
testList.name back to testList and include the following inside the
table element in your template:
<span jwcid="testListColumnValue@Block">
<span jwcid="@Insert" value="ognl:components.table.tableRow.name" />
</span>
the Table component will use this block to render the data in the
testList column instead of the standard rendering.
On 3/21/06, Nima Boustanian <ni...@tn20.com> wrote:
> Hey all
>
> I have two columns in my contrib:table, one returns a string and the
> other one returns a list.
>
> <table jwcid="table@contrib:Table"
> cellpadding="0"
> width="100%"
> class="myTable"
> source="ognl:table"
> columns="testString, testList.name"
> pageSize="5"
> pagesDisplayed="2"/>
>
> I manage to extract the string with the above line, but the testList
> which contains objects with getName methods (that return strings)
> is a bit trickier. I have tried testList.name but without luck, can
> someone please give me some pointers on how this
> should be done?
>
> Thanks!
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org