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

For questions and postings not covered by the other forums
ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

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

Postby ConvertFromOldNGs » Fri Aug 07, 2009 10:25 am

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!

ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

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

Postby ConvertFromOldNGs » Fri Aug 07, 2009 10:25 am

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 ------------------------------------------------------------------

ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

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

Postby ConvertFromOldNGs » Fri Aug 07, 2009 10:25 am

by Á¤ÁöÇå >> Thu, 2 Nov 2006 6:59:39 GMT

many-to-many relationship sample send me.


Return to “General Discussion”

Who is online

Users browsing this forum: No registered users and 21 guests

cron