【问题标题】:ComboxBox in an editable Grid可编辑网格中的组合框
【发布时间】:2013-04-18 06:25:36
【问题描述】:

我是 ExtJS 的新手,现在我正在制作一个带有组合框列的可编辑网格。我在从组合框中显示我选择的数据时遇到问题。愿有人帮助我。截图如下。

Link provided.. :))

我的组合框代码...

数据:

    var farms = new Ext.data.ArrayStore({
    fields: ['id', 'farms'],
    data : [                                         
            ['1', 'DVZ'],
            ['2', 'SSK'],
            ['3', 'LNA'],
            ['4', 'NSK']
           ]
     });

组合框..

 header   : 'Location',
          width    : 130,
          fixed    : true,
          hideable : false,
          dataIndex: 'farms',
          editor   : {xtype:'combo', 
                      store: farms,
                             displayField:'farms',
                             valueField: 'id',
                             queryMode: 'local',
                            typeAhead: true,
                            triggerAction: 'all',
                            lazyRender: true,
                            emptyText: 'Select location...',
                            autoload: true

          }

【问题讨论】:

  • 向我们展示您的组合框代码和网格代码。
  • @Ankit:我已经添加了组合框的代码.. :)))

标签: javascript jsp extjs4 java-ee-6


【解决方案1】:

这可能是您在网格配置中的数据索引值,与您在组合框配置中的值字段不同 例如,在“Responsible”字段中查看此配置

columns: [
     { header: 'ID', dataIndex: 'id', width: 50, hidden: true, sortable: true },
     {header: 'Responsible',
            width: 175,
            sortable: true,
            renderer: title_respU_D1,
            dataIndex: 'resp_user_name'
            ,editor: new Ext.form.ComboBox({
                   typeAhead: true,
                   triggerAction: 'all',
                   store: app_responsibleStore,
                   mode: 'remote',
                   valueField: 'resp_user_name',
                   displayField: 'resp_user_name',
                   listClass: 'x-combo-list-small'
        })
     }

]

【讨论】:

    【解决方案2】:

    您可能在网格面板中项目的编辑器配置中缺少一些“配置”。

    我希望你可能会错过 typeAhead 配置。

    请参考下面的煎茶示例链接

    http://docs.sencha.com/extjs/4.0.7/extjs-build/examples/grid/cell-editing.html

    谢谢。

    【讨论】:

    • 该链接确实帮助了我.. 刚刚发现我的 dataIndex 应该是我的标题的名称.. 我所做的是 mydataIndex 是我的商店.. xD 非常感谢...
    猜你喜欢
    • 2011-08-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-06-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多