ExtJS的GridPanel中与单选按钮的列

问题描述:

所以我有一个常用的网格,一些列:ExtJS的GridPanel中与单选按钮的列

    { 
         xtype   : 'gridpanel', 
         mode   : "MULTI", 
         region   : 'center', 
         title   : "grid", 
         id    : 'datagridResult', 
         margin   : '10 5 5 5', 

        columns : [ 
           { 
            xtype : 'gridcolumn', 
            dataIndex: 'TEST', 
            flex  : 0.25 
           }, 
           { 
            xtype : 'gridcolumn', 
            dataIndex: 'Test2' 
            flex  : 2 
           }, 
           //... 

我要的是增加3个列,其是单选按钮(每列一个按钮)。我试过这样的:

       { 
            xtype : 'gridcolumn', 
            text  : "FOR" 
            dataIndex: 'for', 
            flex  : 1, 
            editor: { 
             xtype  : 'radiofield', 
             name  : 'Regex', 
             inputValue: 'Checked' 
            }, 
           } 

而且它不起作用。所以我在这里要求任何建议。

而且它不起作用。所以我在这里要求任何sugestions

在ExtJS有xtype:'widgetcolumn'。 窗口小部件列配置了窗口小部件配置对象,该对象指定xtype以指示此列的单元格中的窗口小部件或组件属于哪种类型。

我已经创建了一个Sencha Fiddle演示。它会显示如何工作。希望这会帮助你。

Ext.create('Ext.data.Store', { 
    storeId: 'simpsonsStore', 
    fields: ['name', 'email', 'phone', { 
     name: 'checked', 
     type: 'boolean', 
     defaultValue: true 
    }], 
    data: [{ 
     name: 'Lisa', 
     email: '[email protected]', 
     phone: '555-111-1224' 
    }, { 
     name: 'Bart', 
     email: '[email protected]', 
     phone: '555-222-1234' 
    }, { 
     name: 'Homer', 
     email: '[email protected]', 
     phone: '555-222-1244' 
    }, { 
     name: 'Marge', 
     email: '[email protected]', 
     phone: '555-222-1254' 
    }] 
}); 

Ext.create('Ext.grid.Panel', { 
    title: 'Simpsons', 
    store: Ext.data.StoreManager.lookup('simpsonsStore'), 
    columns: [{ 
     text: 'Name', 
     dataIndex: 'name' 
    }, { 
     text: 'Email', 
     dataIndex: 'email', 
     flex: 1 
    }, { 
     text: 'Phone', 
     dataIndex: 'phone' 
    }, { 
     text: 'Status', 
     width: 150, 
     xtype: 'widgetcolumn', 
     dataIndex: 'checked', 
     onWidgetAttach: function (column, widget, record) { 
      widget.down(`[inputValue=${record.get('checked')}]`).setValue(true); 
     }, 
     widget: { 
      xtype: 'radiogroup', 
      items: [{ 
       boxLabel: 'Yes', 
       inputValue: true 
      }, { 
       boxLabel: 'No', 
       inputValue: false 
      }] 
     } 
    }], 
    height: 200, 
    width: 400, 
    renderTo: Ext.getBody() 
}); 
+0

谢谢,谨慎的我想要的 – Chazz1

+0

非常欢迎☺ –