`
zhengjianbo
  • 浏览: 5227 次
  • 性别: Icon_minigender_1
  • 来自: 上海
文章分类
社区版块
存档分类
最新评论

GRID添加行按钮以及按钮事件

阅读更多
var btrender=function renderDescn(value, cellmeta, record, rowIndex, columnIndex, store) {
        var contentId = Ext.id();
//var contentId=value;
//获取行所在的ID,处理前先建立一个Button实体,然后defer到层contentID中,该函数返回的是 一个层contentId
//Button实体就显示在该层中,并可以执行函数
var btn = createGridButton.defer(1, this, [contentId]); 
function createGridButton(){ 
return new Ext.Button({ 
text: 'Confirm', 
iconCls: '', 
handler: function(){ 
addForm();

}).render(document.body, contentId); 

return('<div id="'+contentId+'"/>'); 
/*
        var str = "<input type='button' value='编辑' id='1' onclick='handleAdd();'>";
        //onclick='showEditWin();'
        alert("" +
            "这个单元格的值是:" + value + "\\n" +
            "这个单元格的配置是:{cellId:" + cellmeta.cellId + ",id:" + cellmeta.id + ",css:" + cellmeta.css + "}\\n" +
            "这个单元格对应行的record是:" + record.data["id"] + ",一行的数据都在里边\\n" +
            "这是第" + rowIndex + "行\\n" +
            "这是第" + columnIndex + "列\\n" +
            "这个表格对应的Ext.data.Store在这里:" + store + ",随便用吧。"
            );
        return str;
*/
};

    var addForm=function handleAdd(){
   if(!AddEmpWin){
    AddEmpWin = new Ext.Window({
  title: '添加合作公司',
  layout:'fit',
  width:500,
  height:300,
  plain: true,
  items:EmpForm,
  buttons: [
  {
  text:'保存',
  handler: AddRecord,
  },
  {
  text: '取消',
  handler: function(){
  AddEmpWin.hide();
  fnEnable();
}
  }
]
});
}else{
alert("请先完成该操作,再执行其他操作");
}
        AddEmpWin.show(this);
    };


  {header: 'Change', width: 75, sortable: true,  renderer:btrender,dataIndex: 'change'},
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics