Sencha treepanel drag&drop 적용
2024. 12. 5. 23:26ㆍJavascript/Sencha
Ext.application({
name: 'TreeMultiplePluginsApp',
launch: function () {
Ext.create('Ext.container.Viewport', {
layout: 'fit',
items: [
{
xtype: 'treepanel',
title: 'TreePanel with Multiple Plugins',
rootVisible: false,
store: Ext.create('Ext.data.TreeStore', {
root: {
expanded: true,
children: [
{
text: 'Node 1',
leaf: false,
children: [
{ text: 'Child Node 1', leaf: true },
{ text: 'Child Node 2', leaf: true }
]
},
{
text: 'Node 2',
leaf: false,
children: [
{ text: 'Child Node 3', leaf: true },
{ text: 'Child Node 4', leaf: true }
]
}
]
}
}),
viewConfig: {
plugins: [
{
ptype: 'treeviewdragdrop', // Enable drag-and-drop
dragText: 'Drag and drop to reorganize'
},
{
ptype: 'gridviewresizer', // Enable column resizing
}
]
},
columns: [
{
xtype: 'treecolumn',
text: 'Name',
dataIndex: 'text',
flex: 1
},
{
text: 'Info',
dataIndex: 'info',
flex: 1
}
],
listeners: {
drop: function (node, data, overModel, dropPosition) {
Ext.Msg.alert(
'Node Dropped',
`You moved ${data.records[0].get('text')} to ${overModel.get('text')} (${dropPosition}).`
);
}
}
}
]
});
}
});
셀 에디팅 plugins과는 별개임
Ext.application({
name: 'TreeMultiplePluginsApp',
launch: function () {
Ext.create('Ext.container.Viewport', {
layout: 'fit',
items: [
{
xtype: 'treepanel',
title: 'TreePanel with Multiple Plugins',
rootVisible: false,
store: Ext.create('Ext.data.TreeStore', {
root: {
expanded: true,
children: [
{
text: 'Node 1',
leaf: false,
children: [
{ text: 'Child Node 1', leaf: true },
{ text: 'Child Node 2', leaf: true }
]
},
{
text: 'Node 2',
leaf: false,
children: [
{ text: 'Child Node 3', leaf: true },
{ text: 'Child Node 4', leaf: true }
]
}
]
}
}),
viewConfig: {
plugins: [
{
ptype: 'treeviewdragdrop', // Enable drag-and-drop
dragText: 'Drag and drop to reorganize'
},
{
ptype: 'gridviewresizer', // Enable column resizing
}
]
},
plugins: {
ptype: 'cellediting',
clicksToEdit: 2,
},
columns: [
{
xtype: 'treecolumn',
text: 'Name',
dataIndex: 'text',
flex: 1
},
{
text: 'Info',
dataIndex: 'info',
flex: 1
}
],
listeners: {
drop: function (node, data, overModel, dropPosition) {
Ext.Msg.alert(
'Node Dropped',
`You moved ${data.records[0].get('text')} to ${overModel.get('text')} (${dropPosition}).`
);
}
}
}
]
});
}
});
'Javascript > Sencha' 카테고리의 다른 글
Sencah treepanel에서 1 depth까지만 펼치기 (1) | 2024.12.08 |
---|---|
Sencha checkcolumn 체크 및 이벤트 (0) | 2024.12.08 |
Sencha treepanel에서 값은 바뀌지 않고, depth에 따라 indent처리해서 보여주기 (0) | 2024.12.05 |
Sencha 이미지 사이즈 정보 가져오기 (0) | 2024.12.05 |
Sencha panel에 html을 사용하여 이미지 나오게 하기 (0) | 2024.12.05 |