We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 44429
    • 4 Posts
    Hi guys!
    I have bloody buttheart with setting values in superboxselect sad
    I can get the list of values ['id', 'title'] and show it in superboxselect list. I can select values from superboxselect list and then it's shows in superboxselect frame. I can write this selected values to DB. I can read this selected values from DB to grid.
    But I can't set it up to superboxselect frame smiley
    How it works? How can I show stored values in superboxselect frame? Just simulate clicking on needed values in list or is there a smarter way? smiley

    So. Edition goes from window (not from grid).
    All frames but the superboxselects gets their values and displays it correctly.
    This code for show the input and select frames in window:
    Ext.extend(Salonus.window.Service, MODx.Window, {
    
        getKeys: function() {
            return [{
                key: Ext.EventObject.ENTER,
                shift: true,
                fn: this.submit,
                scope: this
            }];
        },
    
        getFields: function() {
            return [{
                xtype: 'hidden',
                name: 'id'
            }, {
                layout: 'column',
                border: false,
                items: [{
                    columnWidth: 0.5,
                    border: false,
                    layout: 'form',
                    items: [
                        {html: _('salonus_description')},
                        {xtype: 'textfield', fieldLabel: _('salonus_service_name'), description: _('salonus_service_name'), name: 'name', anchor: '100%', allowBlank:false},
                        {xtype: 'numberfield', fieldLabel: _('salonus_service_price'), name: 'price', anchor: '100%', allowBlank:false},
                        {xtype: 'salonus-combo-specialties', fieldLabel: _('salonus_service_specialty'), name: 'specialties', anchor: '100%', allowBlank: false, resizable: true, renderTo: Ext.getBody()},
                        {xtype: 'xcheckbox', fieldLabel: _('salonus_service_fix_price'), name: 'fixed', anchor: '100%'},
                        {xtype: 'numberfield', fieldLabel: _('salonus_service_fix_rate'), name: 'fix_rate', anchor: '100%'},
                        {xtype: 'numberfield', fieldLabel: _('salonus_service_rate'), name: 'rate', anchor: '100%'}
    
                    ]
                },{
                    columnWidth: 0.5,
                    border: false,
                    layout: 'form',
                    items: [
                        {html: _('salonus_consumable')},
                        {xtype: 'xcheckbox', fieldLabel: _('salonus_service_used_material'), name: 'has_product', anchor: '100%'},
                        {xtype: 'salonus-combo-products2', fieldLabel: _('salonus_materials'), name: 'products',  anchor: '100%', resizable: true ,renderTo: Ext.getBody()}
                    ]
                }]
            }];
        }
    
    });
    Ext.reg('xr-window-service', Salonus.window.Service);
    


    This code for getting list of able values ['id','title'] for superboxselect
    Salonus.combo.Specialties = function (config) {
        config = config || {};
    
        Ext.applyIf(config, {
            xtype: 'superboxselect',
            allowBlank: true,
            msgTarget: 'under',
            allowAddNewData: true,
            addNewDataOnBlur: true,
            pinList: false,
            resizable: true,
            name: config.name + '[]',
            anchor: '100%',
            minChars: 1,
            store: new Ext.data.JsonStore({
                id: config.name + '-store',
                root: 'results',
                autoLoad: true,
                autoSave: false,
                totalProperty: 'total',
                fields: ['id','title'],
                url: Salonus.config['connector_url'],
                baseParams: {
                    action: 'mgr/services/getspecialties',
                    salon_id: MODx.request.id,
                    service_id: Salonus.config.row ? Salonus.config.row.id : '0'
                }
            }),
            mode: 'remote',
            displayField: 'title',
            valueField: 'id',
            triggerAction: 'all',
            extraItemCls: 'x-tag',
            expandBtnCls: 'x-form-trigger',
            clearBtnCls: 'x-form-trigger',
        });
        config.name += '[]';
    
        Salonus.combo.Specialties.superclass.constructor.call(this, config);
    };
    Ext.extend(Salonus.combo.Specialties, Ext.ux.form.SuperBoxSelect);
    


    On attached images you can see the list which doesn't show values selected before and stored in DB (this stored values properly shows in grid only but not in the window), and on another image you can see selected items which then overwrites values already present in DB after save.

    Description of Problem: Can't show stored values in superboxselect.

    This question has been answered by bakimenko. See the first response.

    [ed. note: bakimenko last edited this post 7 years ago.]
    • discuss.answer
      • 44429
      • 4 Posts
      I found an answer here https://github.com/benjamin-vauchel/SuperBoxSelect/blob/master/manager/templates/default/element/tv/renders/input/superboxselect.tpl
      It's
      value:'{$values}',

      Or
      dataIndex:
      as simle enumeration of id's like '1,2,3,4,5'