日期:2014-05-16  浏览次数:20389 次

gridpanel某一列可编辑和某一列加复选框
菜鸟现在有两个问题:1,gridpanel和store绑定之后,数据也能正常显示在grid上,可现在要求把数据中的某一列编辑为手动输入,不知道是在远grid上设置,还是在store中设置;
2,在另外一个grid前面添加一个复选框,就是可以选择某一行数据,然后可以点“修改”按钮,现在这个复选框的问题不知道怎么添加进去,而且只能单选其中一行进行修改。
两个问题现在主要是第一个问题,要编辑数据之后,保存返回到后台,现在就卡在我这个地方,后面的数据进行不了。
请求大神帮忙,能有可行的代码加进去更好。
------解决方案--------------------
可编辑在column中设置,editor:{xtype:'textfield',allowBlank:false},

   var rolecols = [{
  width:25,
  renderer:function(value)
  {
  return '<img src= ././image/role.png />';
  }
  },{
    text:'角色编号',
    dataIndex:'rolecode',
    width:100
   },{
    text:'角色名称',
    dataIndex:'rolename',
    editor:{xtype:'textfield',allowBlank:false},
    width:200
   },{
    text:'描述',
    dataIndex:'describe',
    editor:{xtype:'textfield'},
    flex:1
   }];

gridpanel中设置列为上面的变量

 var gridrole = Ext.create('RoleGrid',{
  id:'gridrole',
  columns:rolecols,
  tbar:rolebar,
  border:false,
  plugins: [
        Ext.create('Ext.grid.plugin.CellEditing', {
            clicksToEdit: 1
        })]
 });

------解决方案--------------------
引用:
Quote: 引用:

可编辑在column中设置,editor:{xtype:'textfield',allowBlank:false},

刚刚我们项目组长给了另外一个方法,版主可以看下
  我是在Sencha Architect上运行实现的,组长在store显示的数据组中添加了CellEditingPlugin事件,再在grid中添加了
xtype: 'gridcolumn',
                                            width: 50,
                                            dataIndex: 'mark',
                                            text: 'Mark',
                                            editor: {
                                                xtype: 'textfield',
                                               &n