0

我有以下代码:

function selectClassWindow() {
    classes = Ext.create('Ext.tree.Panel', {
        store: Ext.create('Ext.data.TreeStore', {
            autoLoad: true,
            autoSync: true,
            fields: ['id','name', 'description','cost'],
            proxy: {
                type: 'ajax',
                api: {
                    read: '/otp/getClass/'
                }
            },
            root: {
                name: 'Name1',
                id: 0,
                expanded: true
            },
            listeners: {
                load: function (tree, node, records) {
                        node.eachChild(function (childNode){
                            childNode.set('checked',false);
                        });
                }
            }
        }),
        border: false,
        rootVisible: false,
        useArrows: true,
        hideHeaders: true,
        height: window.MaxHeightWindows,
        xtype: 'listTree',
        columns: [
            {
                xtype: 'treecolumn',
                text: 'Name2',
                flex: 1,
                sortable: true,
                dataIndex: 'name'
            },</code>

Want to add here!

                {
                    xtype: 'customspinner',
                    fieldLabel: 'How Much Beer?',
                    step: 6
                }    
            ]
        })


    classes.on('itemdblclick', function() {
        selectedNode = classes.getSelectionModel().getSelection()
        if (selectedNode[0] && selectedNode[0].isLeaf()) {
            selectedClass = selectedNode[0].data.id 
            selectWindow.close()
            if((window.selectedNode[0].parentNode&&selectedNode[0].parentNode.data.name == 'Text1')||
            (window.selectedNode[0].parentNode.parentNode&&selectedNode[0].parentNode.parentNode.data.name == 'Text1')||
            (window.selectedNode[0].parentNode.parentNode.parentNode&&selectedNode[0].parentNode.parentNode.parentNode.data.name == 'Text1')){
                selectReasonWindow()
            }else{
                Ext.Ajax.request({
                        url: '/defect/updateDeparture/'+rec.data.id,
                        params: {
                            class_id: selectedClass,
                            reason_id: 0
                        },
                        success: function(result,response) {
                            if (window.departureGrid) {
                                departureGrid.store.load()
                            }
                            if (window.departureFullList) {
                                departureFullList.store.load()
                            }
                            if(window.logs){
                                logs.setValue(result.responseText)
                            }
                            if (window.crashDepartureList) {
                                crashDepartureList.store.load()
                            }

                        }
                    })
            }
        }
    })

    emptyPanel = Ext.create('Ext.panel.Panel', {
        border: false,
        flex: 1,
        items: [classes]
    })

    selectWindow = Ext.create('Ext.window.Window', {
        title: 'Name3',
        width: 750,
        border: false,
        layout: {
            type: 'hbox',
        },
        resizable:false,
        collapsible: false,
        constrain: true,
        modal:true,
        plain:true,
        items: [emptyPanel],
        buttons: [{
            text: 'Ok',
            handler: function() {
                selectedNode = classes.getSelectionModel().getSelection()
                if (selectedNode[0] && selectedNode[0].isLeaf()) {
                    selectedClass = selectedNode[0].data.id 
                    selectWindow.close()   
                    if((window.selectedNode[0].parentNode&&selectedNode[0].parentNode.data.name == 'Text1')||
                    (window.selectedNode[0].parentNode.parentNode&&selectedNode[0].parentNode.parentNode.data.name == 'Text1')||
                    (window.selectedNode[0].parentNode.parentNode.parentNode&&selectedNode[0].parentNode.parentNode.parentNode.data.name == 'Text1')){
                        selectReasonWindow()
                    }else{
                        Ext.Ajax.request({
                                url: '/defect/updateDeparture/'+rec.data.id,
                                params: {
                                    class_id: selectedClass,
                                    reason_id: 0
                                },
                                success: function(result,response) {
                                    if (window.departureGrid) {
                                        departureGrid.store.load()
                                    }
                                    if (window.departureFullList) {
                                        departureFullList.store.load()
                                    }
                                    if(window.logs){
                                        logs.setValue(result.responseText)
                                    }
                                    if (window.crashDepartureList) {
                                        crashDepartureList.store.load()
                                    }

                                }
                            })
                    }
                }
            }
        },{
            text: 'Close',
            handler: function() {selectWindow.close()}
        }]
    }).show();
}

我想将列“customspinner”添加到 Ext.tree.Panel,但我得到 Uncaught TypeError: Object [object Object] has no method 'setSortState'。怎么了? 终于需要这样的东西

4

1 回答 1

1

有几件事妨碍您:

  1. 网格不支持单元格中的组件(还),它们很快就会支持。现在你可以使用http://skirtlesden.com/ux/component-column
  2. 树已经有一个加载掩码,默认情况下在节点加载时触发。

如果您只想在页面的某处添加微调器,只需遵循 Loading Mask 组件文档。基本上任何 dom 元素都可以使用 mask/unmask 调用作为目标。

于 2013-09-11T07:24:03.243 回答