You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Bruno Haas <gr...@laposte.net> on 2005/04/22 13:48:19 UTC

Dynamic table: going deeper in ognl graph (was: OGNL syntax question)

Hi All,

I have the same problem as Patrick. I'm trying to display a table that 
has a dynamic number of columns. My problem is that I want to be able to 
get properties deeper in the row object.

To take Patricks soldier example, the field list would be the following:
theList = {"name","unit.name", "unit.type"}

If I then do

value="ognl:theRow[theItem.fieldName]" />

Where fieldName would take the "name", "unit.name" and "unit.type" values, this won't work because OGNL indexed properties can't be deep.

Anybody an idea ?

Bruno


Chris Nelson wrote:

>I think theRow[theItem.fieldName] is what you want. 
>I'm doing something quite similar in one of my Trails
>components and this worked for me.
>
>--Chris
>
>--- Patrick Casey <pa...@adelphia.net> wrote:
>  
>
>>This may be an easy question and if so I apologize,
>>but after slogging
>>through the ognl doc, I'm still no closer to an
>>answer to what I'm looking
>>for here.
>>
>>I've got an Object named "theRow".
>>I've got a list of Field Descriptors called
>>"theList".
>>
>>For Each entry in "theList" I want to pluck the
>>appropriate field out of the
>>object.
>>
>>Example:
>>
>>Let theRow be an Object named "soldier" with
>>properties name, rank,
>>serial_number.
>>Let theList = {"name", "rank"}
>>
>>How in ognl syntax do I construct a reference to
>>theRow.[whatgoes here?]?
>>
>>So far I'm looking at something like:
>>
>><td jwcid="@Foreach" element="td" 
>>        source = "ognl:theList" 
>>        value="ognl:theItem">
>>         bar
>>         
>>        <span jwcid="@Insert"
>>value="ognl:theRow.(theItem.fieldName)" />
>>
>>    </td>  
>>
>>But that empathetically doesn't work. Is there some
>>ognl equivalent to the
>>javascript "eval" function or something I could call
>>here?
>>
>>Ideally I'm looking to output:
>>
>><td> ognl:theRow.name </td>
>><td> ognl:theRow.rank </td>
>>
>>
>>And have that then get resolved to:
>>
>><td> Patton </td>
>><td> General </td>
>>
>>Any help would be appreciated,
>>
>>--- Pat 
>>
>>
>>
>>
>>    
>>
>---------------------------------------------------------------------
>  
>
>>To unsubscribe, e-mail:
>>tapestry-user-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail:
>>tapestry-user-help@jakarta.apache.org
>>
>>
>>    
>>
>
>
>		
>__________________________________ 
>Yahoo! Mail Mobile 
>Take Yahoo! Mail with you! Check email on your mobile phone. 
>http://mobile.yahoo.com/learn/mail 
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>
>  
>


RE: Dynamic table: going deeper in ognl graph (was: OGNL syntax question)

Posted by Patrick Casey <pa...@adelphia.net>.
	Bruno,

	I eventually had to scrap my row component and just roll my own
"table" component. I'm not sure why, but nesting foreach (one per row to
iterate the column list) inside of another foreach (one per table to iterate
the set of rows), was murder on my performance (14 seconds to render 1,000
rows, even if I took out all the render code so the loops were running
noops).

	I eventually just wrote a java class that spits out the rows
directly by using the render method. Render time is down under 0.2 seconds
now for the same 1,000 rows).

	Generally I've found tapestry binding to be pretty fast, but the
specific case of nested foreach just seems to slay it. To clarify exactly
what I'm looking at (pseudo code here):

	<foreach row>
		<td>
			Soldier.name
		</td>
			Soldier.rank
		<td>
	</row>

	The above is acceptably fast (no nested foreach) aprox 2.5 seconds
for 1000 rows.

	<foreach row>
		<foreach column>
			<td>
				currentRow[currentColumn]
			<td>
		</column>
	</row>

	Is really slow (I *think* because of the nested foreach). Aprox 14
seconds for 1000 rows.

	In any event if you're looking to push large amounts of data out
into a table I wouldn't recommend using the nested foreach approach you (and
I) were looking at. I was happy with it until I increased the size of my
test set, then I had to tear it out.

	--- Pat

-----Original Message-----
From: Bruno Haas [mailto:grinob.haas@laposte.net] 
Sent: Friday, April 22, 2005 4:48 AM
To: Tapestry users
Subject: Dynamic table: going deeper in ognl graph (was: OGNL syntax
question)

Hi All,

I have the same problem as Patrick. I'm trying to display a table that 
has a dynamic number of columns. My problem is that I want to be able to 
get properties deeper in the row object.

To take Patricks soldier example, the field list would be the following:
theList = {"name","unit.name", "unit.type"}

If I then do

value="ognl:theRow[theItem.fieldName]" />

Where fieldName would take the "name", "unit.name" and "unit.type" values,
this won't work because OGNL indexed properties can't be deep.

Anybody an idea ?

Bruno


Chris Nelson wrote:

>I think theRow[theItem.fieldName] is what you want. 
>I'm doing something quite similar in one of my Trails
>components and this worked for me.
>
>--Chris
>
>--- Patrick Casey <pa...@adelphia.net> wrote:
>  
>
>>This may be an easy question and if so I apologize,
>>but after slogging
>>through the ognl doc, I'm still no closer to an
>>answer to what I'm looking
>>for here.
>>
>>I've got an Object named "theRow".
>>I've got a list of Field Descriptors called
>>"theList".
>>
>>For Each entry in "theList" I want to pluck the
>>appropriate field out of the
>>object.
>>
>>Example:
>>
>>Let theRow be an Object named "soldier" with
>>properties name, rank,
>>serial_number.
>>Let theList = {"name", "rank"}
>>
>>How in ognl syntax do I construct a reference to
>>theRow.[whatgoes here?]?
>>
>>So far I'm looking at something like:
>>
>><td jwcid="@Foreach" element="td" 
>>        source = "ognl:theList" 
>>        value="ognl:theItem">
>>         bar
>>         
>>        <span jwcid="@Insert"
>>value="ognl:theRow.(theItem.fieldName)" />
>>
>>    </td>  
>>
>>But that empathetically doesn't work. Is there some
>>ognl equivalent to the
>>javascript "eval" function or something I could call
>>here?
>>
>>Ideally I'm looking to output:
>>
>><td> ognl:theRow.name </td>
>><td> ognl:theRow.rank </td>
>>
>>
>>And have that then get resolved to:
>>
>><td> Patton </td>
>><td> General </td>
>>
>>Any help would be appreciated,
>>
>>--- Pat 
>>
>>
>>
>>
>>    
>>
>---------------------------------------------------------------------
>  
>
>>To unsubscribe, e-mail:
>>tapestry-user-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail:
>>tapestry-user-help@jakarta.apache.org
>>
>>
>>    
>>
>
>
>		
>__________________________________ 
>Yahoo! Mail Mobile 
>Take Yahoo! Mail with you! Check email on your mobile phone. 
>http://mobile.yahoo.com/learn/mail 
>
>---------------------------------------------------------------------
>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