Re: Newbie : How to display 2 differents records on the same line in a table
Re: Newbie : How to display 2 differents records on the same line in a table
- Subject: Re: Newbie : How to display 2 differents records on the same line in a table
- From: "Jerry W. Walker" <email@hidden>
- Date: Fri, 28 Jul 2006 11:22:49 -0400
Hi, Gilles,
If you use WebObjects Builder to create a table, notice that when the
"New Table" wizard panel is displayed, at the bottom of the panel are
two check boxes. If you create a two row table and click the second
of those check boxes (labelled: "Second row is wrapped in a
WORepetition"), then it will create the table as described, with the
second row wrapped in a WORepetition.
You can put any number of cells in that row and anything you want in
those cells, including two or three separate records coming from the
same DB table.
The best way to do that would probably be to use the WORepetition's
index binding, use an arbitrary index in your code and play games
with the index in extracting objects from the array holding your DB
table's objects, e.g.:
public int repIndex;
private NSArray myObjectsFromDB;
// Fill your myObjectsFromDB array in the component's
initialization code.
...
public MyObjectFromDB col1Object()
{
return myObjectsFromDB.objectAtIndex(repIndex * 3);
}
public MyObjectFromDB col2Object()
{
return myObjectsFromDB.objectAtIndex( (repIndex * 3) + 1);
}
public MyObjectFromDB col3Object()
{
return myObjectsFromDB.objectAtIndex( (repIndex * 3) + 2);
}
...
Don't use the list or item bindings of the WORepetition, rather, bind
the repIndex to the index binding of WORepetion. Then bind each of
the variables you're displaying in the table to one of the above
three methods. WORepetition will update the repIndex for you. You
merely play with its value to extract the records you're looking for
in the place you want them.
Regards,
Jerry
On Jul 28, 2006, at 9:01 AM, Gilles MATHURIN wrote:
Hello , everyone
I learned a lot ought to you and the ressources links you give. I
now use WORepetition to display records from my database quite well
But i wonder how can i display 2 or 3 records (coming from the same
table) in one raw of a table ?
Do WORepetition handle that ?
Illustration :
Column 1 Column 2 Column 3
Table Line 1 : <Data1> | <Data2> | <Data3>
Any Clue ?
Thanx
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40gmail.com
This email sent to email@hidden
--
__ Jerry W. Walker,
WebObjects Developer/Instructor for High Performance Industrial
Strength Internet Enabled Systems
email@hidden
203 278-4085 office
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden