EXTJS 树拖拽和表格拖拽 plugins
2016-01-22 09:53
591 查看
1、TreePanel :ptype: ‘treeviewdragdrop’
2、Grid :ptype:’gridviewdragdrop’
var guestBarTree = Ext.create('Ext.tree.Panel', { width: 200, height: '50%', store: guestBarStore, displayField: 'dataName', rootVisible: true, region: 'south', enableDD: true,//是否支持拖拽效果 viewConfig: { name: 'barTreeView', plugins: { ptype: 'treeviewdragdrop', ddGroup: 'ddTreeGroup'//自定义,名字相同可组件之间拖动 }, allowCopy: true, listeners: { 'beforedrop': dropHandler//落下之前执行函数 } }, listeners: { 'itemclick': function (_this, record) { mainBarTree.getSelectionModel().deselectAll(); nodeInfoStore.loadRawData(getNodeInfo(record)); if (barMenu) { barMenu.hide(); } }, itemcontextmenu: itemcontextHandler,//鼠标右键 containerclick: function () { if (barMenu) { barMenu.hide(); } } } });
2、Grid :ptype:’gridviewdragdrop’
var tablePanelNorth = Ext.create('Ext.panel.Panel', { layout: 'hbox', region: 'north', border: 0, height: 200, items: [{ xtype: 'grid', flex: 1, height: '100%', store: nodeInfoStore, viewConfig: { name: 'barTreeView', plugins: { ptype: 'gridviewdragdrop', ddGroup: 'ddTreeGroup', enableDrag: false }, listeners: { 'beforedrop': function (n, data, overModel, dropPosition, dropHandlers) { if (data.view.name == 'barTreeView') {//从主栏或者宾栏拖拽过来的 Ext.Msg.alert('提示', '不能拖主宾栏的信息'); return false; } } } }, listeners: { itemclick: function () { nodeInfoMenu.hide(); }, itemcontextmenu: function (_this, record, item, index, e) { e.preventDefault(); nodeInfoMenu.showAt(e.getPoint()); }, containerclick: function () { nodeInfoMenu.hide(); } }, columns: [{ text: '类型', dataIndex: 'isProperty', flex: 0.5, renderer: function (data) { if (data) { return '属性信息'; } return '基本信息'; } }, { text: '数据类型', dataIndex: 'dataType', flex: 0.5, renderer: function (data) { } }, { text: '数据名', dataIndex: 'dataName', flex: 1 }, { text: '节点属性', dataIndex: 'isRealNode', flex: 0.5, renderer: function (data) { } }, { text: '附加信息', flex: 1, renderer: function (data, m, record) { } }], tbar: ['<b>节点信息</b>', '->', { xtype: 'button', text: '保存', handler: function () { } }] }, { xtype: 'panel', flex: 1, height: '100%', tbar: ['<b>表格信息</b>', '->', { xtype: 'button', text: '隐藏基本信息', handler: function (btn) { } }] }] })
相关文章推荐
- extjs grid取到数据而不显示的解决
- ExtJS下grid的一些属性说明
- Extjs在exlipse中设置自动提示的方法
- 常用Extjs工具:Extjs.util.Format使用方法
- extjs DataReader、JsonReader、XmlReader的构造方法
- 学习ExtJS(一) 之基础前提
- extjs 为某个事件设置拦截器
- ExtJs 学习笔记基础篇 Ext组件的使用第1/2页
- Extjs列表详细信息窗口新建后自动加载解决方法
- Extjs grid添加一个图片状态或者按钮的方法
- Extjs学习笔记之四 工具栏和菜单
- extjs form textfield的隐藏方法
- ExtJS 2.0实用简明教程之应用ExtJS
- ExtJS Store的数据访问与更新问题
- 不用写JS也能使用EXTJS视频演示
- Extjs改变树节点的勾选状态点击按钮将复选框去掉
- extjs 列表框(multiselect)的动态添加列表项的方法
- ExtJs默认的字体大小改变的几种方法(自己整理)
- ExtJS 配置和表格控件使用第1/2页
- 解决extjs在firefox中关闭窗口再打开后iframe中js函数访问不到的问题