如何使用treeGrid的行编辑器插件

时间:2012-02-03 11:43:49

标签: treegrid

我有一个treegrid,我需要将它作为editorGrid。

我的treegrid是

var tree = new Ext.ux.tree.TreeGrid({
    title: 'Core Team Projects',
     height: 500,
    renderTo: Ext.getBody(),
      autoLoad:false,
    plugins: [editor],
      columns:[
        {
        header: 'Name',
        dataIndex: 'name',
        width: 230
    },{
        header: 'length',
        width: 150,
        sortType: 'asFloat',
        dataIndex: 'length'
    },{
        header: 'size',
        width: 150,
        sortType: 'asFloat',
        dataIndex: 'size'
    },{
        header: 'dataType',
        width: 150,
        dataIndex: 'dataType'
    },{
        header: 'extName',
        width: 150,
        dataIndex: 'extName'
    },{
        header: 'overlay',
        width: 150,
        dataIndex: 'overlay'
    },{
        header: 'qualified',
        width: 150,
        dataIndex: 'qualified'
    }],
    loader: myTreeLoader

});

我使用的编辑器是

var editor = new Ext.ux.grid.RowEditor({
    saveText: 'Save',
    errorSummary : true,
    monitorValid: true,
    clicksToEdit: 1,
    // floating: true,
    shadow: true,
    layout: 'hbox',
    cls: 'x-small-editor',
    buttonAlign: 'center',
    baseCls: 'x-row-editor',
    elements: 'header,footer,body',
    frameWidth: 5,
    buttonPad: 3,
    focusDelay: 250,
    cancelText: 'Cancel',
    //commitChangesText: 'You need to Update or Cancel your changes',
    // errorText: 'Errors',

    defaults: {
        normalWidth: true
    }
});

它给出错误“对象不支持此属性或方法”

有人可以提供解决方案

1 个答案:

答案 0 :(得分:0)

Extjs v3.xx中的“Ext.ux.tree.TreeGrid”不是真正的“网格”(基于treepanel + treeloader ......),这就是你不能使用“Ext.ux.grid”的原因。 RowEditor“(因为roweditor需要一个网格+商店......)。

2解决方案:

  • 切换到Extjs v4.x.x,您可以使用“Ext.grid.plugin.CellEditing”:
  

ExtJs TreeGrid with editor column. Exists?

  • 覆盖createNode(在“Ext.ux.tree.TreeGridLoader”中)或修改“Ext.ux.tree.TreeGridNodeUI”:
  

http://www.sencha.com/forum/showthread.php?118393-treegrid-checkbox-extension

     

Checkbox Column in ExtJS TreeGrid

(放置复选框的示例,您可以修改以放置其他组件......)

祝你好运......