Grid中的ComboBox

时间:2012-06-24 18:24:34

标签: javascript extjs

请帮助我,如何在字段中插入组合框

text: "Combo need is here!!!", width: 100, dataIndex: '', sortable: true

这里需要组合框......

极少数关于extjs的材料:(

还有一个问题,如果适用于移动界面的extjs? 我有一个在线商店,实用的extjs移动界面?

我的代码:

Ext.onReady(function(){
  Ext.define('User', {
    extend: 'Ext.data.Model',
    fields: [
      {name: 'id', type: 'int'},
      {name: 'day', type: 'string'},
      {name: 'time', type: 'string'},
      {name: 'what', type: 'string'},
      {name: 'combo', type: 'string'}
    ]
  });

  var store = Ext.create('Ext.data.Store', {
    model: 'User',
    proxy: {
      type: 'ajax',
      url: 't.php',
      reader: {
        type: 'json'
      }
    }
  });

  var grid = Ext.create('Ext.grid.Panel', {
    store: store,
    columns: [
      {
        text: "Day", flex: 1, dataIndex: 'day', sortable: true
      },
      {
        text: "Time", width: 115, dataIndex: 'time', sortable: true
      },
      {
        text: "sourse", width: 100, dataIndex: 'what', sortable: true
      },
      {
        text: "Combo need is here!!!", width: 100, dataIndex: '', sortable: true // HERE!!!
      }
    ],
    height:700,

    renderTo: 'grid-example'
  });

  store.load();
});

1 个答案:

答案 0 :(得分:1)

您应该使用CellEditing或RowEditing插件,并将该字段的编辑器属性设置为'combobox'

http://docs.sencha.com/ext-js/4-1/#!/example/grid/cell-editing.html

您不应该将Sencha ExtJS用于移动设备。相反,你应该使用Sencha Touch 2

http://www.sencha.com/products/touch/