Sebastien
Sebastien

Reputation: 6660

Add a disclosure to a fieldset field

I have a fieldset like this :

Ext.define('admin.view.BuzzEditForm', {
    extend: 'Ext.form.Panel',
    requires: ['Ext.form.FieldSet','Ext.Img'],
    id: 'editorPanel',
    xtype: 'buzzEditForm',
    config: {
        /* modal: true,
         hideOnMaskTap: false,
         centered: true,
         width: 500,
         scrollable: false,*/
        items: [{
            xtype: 'fieldset',
            items: [
                {
                    xtype: 'textfield',
                    name: 'keyword',
                    label: 'Mots clés'
                },
                {
                    xtype: 'textfield',
                    name: 'title',
                    label: 'Titre'
                },
                {
                    id: 'editorPanelvisual',
                    xtype: 'field',
                    label: 'Visuel actuel',
                    component: {
                        xtype: 'image',
                        src: '',
                        height: 200
                    }
                },
                {
                    xtype: 'textfield',
                    name: 'visual',
                    label: 'Visuel'
                }
            ]
        }]
    }
});

And i want to add a button to my editorPanelvisual field. How can i do that?

Upvotes: 2

Views: 1120

Answers (1)

Thiem Nguyen
Thiem Nguyen

Reputation: 6365

This requires you deeper understanding about Ext.data.Field:

component is a special config for input fields and by default, it's set to {xtype: "input", type: "text"}, that's the key of this work-around. Scale your textfield vs button widths with flex config

Try this:

{
    id: 'editorPanelvisual',
    xtype: 'field',
    component: {
      xtype: 'container', 
      layout: 'hbox', 
      items: [
      {
        xtype: 'textfield', 
        flex: 3,
      }, 
      {
        xtype: 'button', 
        flex: 1, 
        text: 'test'
      }
      ]},
},

Upvotes: 2

Related Questions