2
我在extjs中有一棵樹。我已經在瀏覽器中添加了拖放插件和那些功能,但是我需要將拖放更改發送到我的數據庫正確嗎?要做到這一點,我相信我應該聽取下降事件,然後對我的後端進行ajax調用。 我有一個checkchange事件可以觸發,但是drop或beforedrop甚至看起來什麼都不做。使用Drop或Beforedrop偵聽器的ExtJS拖放樹似乎不會觸發
這是我的樹的配置,我做錯了什麼?
todotree = {
title: 'Tree Grid',
width: 600,
height: 400,
viewConfig: {
plugins: {
ptype: 'treeviewdragdrop'
}
},
store: new Ext.data.TreeStore({
storeId: 'treestore',
fields: [{
name: 'actionTitle',
type: 'string'
}],
proxy: {
type: 'ajax',
url: 'index.php/todo/listtree',
reader: 'json'
}
}),
rootVisible: false,
columns: [
{
xtype: 'treecolumn',
text: 'Title',
flex: 3,
dataIndex: 'actionTitle'
}],
listeners: {
checkchange: function(node, checked){
Ext.Ajax.request({
url: 'index.php/todo/togglecheck/' + node.data.recordId + '/' + checked,
success: function() {}
});
},
drop: function(){ alert("drop") },
beforedrop: function(){ alert("beforedrop") }
}
}
在此先感謝
編輯: 我也試過這個配置無濟於事。我不認爲我理解這是如何工作的。
...
beforedrop: function(node, data, overModel, dropPosition, dropFunction){
alert("beforedrop");
dropFunction = function(){
alert('dropFunction');
};
}
...
非常感謝。那正是我需要的。 – Chris
這需要在Panel中進行,而不是TreeStore,答案的措辭有點難以理解。 – relipse
'node'參數('beforedrop(node,data,overModel,dropPosition,dropFunction,eOpts)')給了我一個HTML標籤('')。我如何獲得移動的TreeNode? –
|