We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 37108
    • 80 Posts
    Wracking my brain trying to figure this one out: In the contact management part of my mail module, I have a few combo boxes from which to assign a person's group, market, etc. which appear in the contact edit form. The data for these various attributes is stored separate from the contact's personal details. A quick snapshot of the schema:

    contacts
    id, firstname, lastname, etc....
    groups
    id, groupname
    contacts_groups
    contact_id, group_id

    My combo box for the groups is as follows so far (for now I've elected not to use the SuperBoxSelect):
    Flexmail.combo.contactGroups = function (config) {
        config = config || {};
        Ext.applyIf(config, {
        	xtype:'multiselect',
        	width:'400',
            triggerAction: 'all',
            valueField: 'id',
            displayField: 'name',
            mode: 'remote',
            store: new Ext.data.JsonStore({
                storeId:'grouplist',
                autoLoad: true,
                root:'results',
                idProperty:'id',
                fields: ['id','groupname','isDefault','sortIndex'],
                url: Flexmail.config.connectorUrl,
                baseParams:{
                    action: 'mgr/contacts/groupslist'
                }
            })
        });
        console.log(this);
        Flexmail.combo.contactGroups.superclass.constructor.call(this, config);
    };
    Ext.extend(Flexmail.combo.contactGroups, Ext.ux.form.MultiSelect);
    Ext.reg('flexmail-combo-contactgroupslist', Flexmail.combo.contactGroups);
    


    This grabs my list of groups just fine. Now I need to be able to query the contacts_groups table based on the contact being edited to set the existing group assignments to selected (setValue on the combo). How does one do that? Also, how do you pass the id of the record being worked with to this combo? [ed. note: smg6511v2 last edited this post 13 years, 7 months ago.]