2014-06-20 2 views
0

나는 이런 식으로 뭔가를 달성하려는 작동하지 트리 드래그 앤 드롭에 그리드 :의 ExtJS 4.1.1 :

http://jsfiddle.net/mgill21/3HJXX/2/

그러나 나는 (리프 노드)를 TREECOLUMN에 그리드에서 노드를 드롭 할 때마다 node.updateInfo() is undefined 및 기타 노드와 관련하여 정의되지 않은 오류가 발생합니다.

Ext.namespace('Ext.ux.window.ConfigureMobileApp'); 
Ext.require([ 'Ext.grid.*', 'Ext.data.*', 'Ext.dd.*' ]); 

var firstGridStore = Ext.create('Ext.data.Store', { 
storeId : 'formStore', 
fields : [ 'name', 'type', 'itemId' ], 
data : [ { 
    name : "Michael Scott", 
    itemId : 7, 
    type : "Management" 
}, { 
    name : "Dwight Schrute", 
    itemId : 2, 
    type : "Sales" 
}, { 
    name : "Jim Halpert", 
    itemId : 3, 
    type : "Sales" 
}, { 
    name : "Kevin Malone", 
    itemId : 4, 
    type : "Accounting" 
}, { 
    name : "Angela Martin", 
    itemId : 5, 
    type : "Accounting" 
} ] 
}); 

// declare the source Grid 
var firstGrid = Ext.create('Ext.grid.Panel', { 
viewConfig : { 
    plugins : { 
     ptype : 'gridviewdragdrop', 
     ddGroup : 'selDD' 
    } 
}, 
store : Ext.data.StoreManager.lookup('formStore'), 
columns : [ { 
    text : "Name", 
    flex : 1, 
    sortable : true, 
    dataIndex : 'name' 
}, { 
    text : "Type", 
    width : 70, 
    sortable : true, 
    dataIndex : 'type' 
} ], 
stripeRows : true, 
title : 'First Grid', 
margins : '0 2 0 0', 
width : 200 
}); 

Ext.define('Resource', { 
extend : 'Ext.data.Model', 
fields : [ { 
    name : "name", 
    type : "string" 
}, { 
    name : "type", 
    type : "string" 
} ] 
}); 

var store1 = Ext.create('Ext.data.TreeStore', { 
storeId : 'treeStore', 
fields : [ 'name', 'type', 'itemId' ], 
root : { 
    expanded : true, 
    children : [ { 
     itemId : 171, 
     type : "comedy", 
     name : "Mr Bean", 
     children : [ { 
      leaf : true, 
      itemId : 171, 
      type : "actor", 
      name : "Rowan Atkinson" 
     } ], 
    }, { 
     itemId : 11, 
     type : "fantasy", 
     name : "Harry Potter", 
     children : [ { 
      itemId : 11, 
      leaf : true, 
      type : "actress", 
      name : "Emma Watson", 
     } ] 
    }, { 
     itemId : 173, 
     type : "Action", 
     name : "Fast and Furious", 
     children : [ { 
      itemId : 174, 
      type : "actor", 
      name : "Dwayne Johnson", 
      children : [ { 
       leaf : true, 
       itemId : 175, 
       type : "wrestler", 
       name : "The Rock" 
      } ] 
     } ] 
    } ] 
} 
}); 

Ext.define('Ext.ux.window.TreeGrid', { 
extend : 'Ext.tree.Panel', 
title : 'Demo', 
height : 300, 
rootVisible : true, 
singleExpand : true, 
store : Ext.data.StoreManager.lookup('treeStore'), 
columns : [ { 
    xtype : 'treecolumn', 
    text : 'Name', 
    dataIndex : 'name', 
    width : 200 
}, { 
    text : 'Type', 
    dataIndex : 'type' 
} ], 
initComponent : function() { 
    this.callParent(); 
}, 
viewConfig : { 
    plugins : { 
     ptype : 'treeviewdragdrop', 
     ddGroup : 'selDD' 
    }, 
    listeners : { 
     beforedrop : function(node, data) { 
      debugger; 
      data.records[0].set('leaf', true); 
      data.records[0].set('expanded', false); 
      data.records[0].set('checked', true); 
     }, 
     drop : function(node, data, dropRec, dropPosition) { 
      // firstGridStore.store.remove(data.records[0]); 
     } 
    } 
} 
}); 

var secondTree = Ext.create('Ext.ux.window.TreeGrid'); 

Ext.define('Ext.ux.window.ConfigureMobileApp', { 
extend : 'Ext.window.Window', 
title : 'Configure Mobile App', 
height : 600, 
width : 600, 
layout : 'hbox', 
modal : true, 
closeAction : 'hide', 
items : [ firstGrid, secondTree ] 
}); 

이 도와주세요 :

여기 내 코드입니다. 매우 긴 시간 이후로 붙어 있습니다.

답변

0

두 개의 링크를 보내는이 오류로 나가는 데 도움이됩니다. 적절한 해결책은 아니지만 분명히 그 길을 안내 할 것입니다. First Link Second Link