Page 1 of 1

Populate a Combobox with a list of all instances of an Objec

Posted: Fri Aug 07, 2009 10:25 am
by ConvertFromOldNGs
by Anonymous >> Wed, 28 Jul 2004 13:54:22 GMT

Object A and Object B are linked via a many-to-many relationship.

I have a form which browses all instances of Object A.

I would like to add a combobox control to my form which is populated with all instances of Object B, where a user can select an item from the list and click a button to add it to the myBs collection.

I have a feeling i ought to be using 'foreach' and 'addItem' somehow, but I'm new to Jade so I may well be barking up the wrong tree. Any help would be greatly appreciated!

Re: Populate a Combobox with a list of all instances of an Objec

Posted: Fri Aug 07, 2009 10:25 am
by ConvertFromOldNGs
by allistar >> Wed, 28 Jul 2004 20:36:39 GMT

Hi,
You would normally have a root collection of class B instances somewhere, such as:

app.myRoot.allBInstances

It's generally not good practice to use the Class.instances property in production code, it makes it more difficult to extend the system later on (for example, what if you only wanted to put certain clas B instances in that collection?)

To populate the combo box with all of these object you would so something like this:

cbCombo.listCollection(app.myRoot.allBInstances, false, 0);

You'll also have to implement the "displayEVent" event method on the cbCombo combo box to tell JADE which property on the class B instances you want to display.

Regards,
Allistar.
--
------------------------------------------------------------------
Allistar Melville
Software Developer, Analyst allistar@silvermoon.co.nz
Auckland, NEW ZEALAND

Silvermoon Software
Specialising in JADE development and consulting
Visit us at: http://www.silvermoon.co.nz
*NEW* Simple web access to Jade at: www.silvermoon.co.nz/jhp.html ------------------------------------------------------------------

Re: Populate a Combobox with a list of all instances of an Objec

Posted: Fri Aug 07, 2009 10:25 am
by ConvertFromOldNGs
by Á¤ÁöÇå >> Thu, 2 Nov 2006 6:59:39 GMT

many-to-many relationship sample send me.