[模板]为dgrid表格中的cell添加可编辑复制属性(自用)
2014-10-23 18:00
176 查看
html文件
<div> <div data-dojo-attach-point="grid"></div> </div>
js文件
define([ "dojo/_base/declare", "dojo/store/Memory", "dojo/store/Observable", "dojo/dom-construct", "dgrid/editor",//引入这个插件 "dgrid/Keyboard", "dgrid/OnDemandGrid", "dgrid/Selection", "dgrid/selector", "dgrid/extensions/Pagination", "dgrid/extensions/ColumnResizer", "dijit/_TemplatedMixin", "dijit/_WidgetBase", "dijit/_WidgetsInTemplateMixin", "dojo/text!html文件路径/为dgrid表格中的cell添加可编辑复制属性.html" "dojo/domReady!" ], function(declare, Memory, Observable, domConstruct, editor, Keyboard, OnDemandGrid, Selection, selector, Pagination, ColumnResizer, _TemplatedMixin, _WidgetBase, _WidgetsInTemplateMixin, template) { return declare([_WidgetBase, _TemplatedMixin, _WidgetsInTemplateMixin], { templateString: template, data: [{ _index: 1, userName: "haha" }, { _index: 2, userName: "chanhaha" }], constructor: function() { this.inherited(arguments); }, postCreate: function() { this.inherited(arguments); this.main(); }, main: function() { this._setGrid(this.data); }, _setGrid: function(data) { var layout = { col1 : selector({resizable: false, width: 40}), name : editor({label: "用户名", width:55, resizable: false}, "text", "click"),//editor这个插件可以允许对cell进行编辑。 selfLabel : {label: "自定义标签", resizable: false, width: 210} }; this._store = new Memory({ data: data }); this._store = new Observable(this._store); this._grid = new(declare([OnDemandGrid, Selection, Keyboard, Pagination, ColumnResizer]))({ columns: layout, store: this._store, allowSelectAll: true, allowTextSelection: true,//Selection插件中的allowTextSelection属性默认为false,设置为true,可以允许对表格文本进行复制。 style: "", selectionMode: "toggle", pagingLinks: 2, rowsPerPage: 10, pagingTextBox: true, firstLastArrows: true, loadingMessage: "数据加载中...", noDataMessage: "暂无数据。" }, this.grid); this._grid.startup(); } }); });
示例图
相关文章推荐
- [模板]给dgrid表格添加自定义标签(自用)
- javaFxTableView可编辑表格,当我添加一个TextFieldTableCell至TableColumn的CellFactory中后,在编辑数据时后台报错
- 当GridPanel添加新的条目的时候,第一个可编辑Cell自动Focus 推荐
- 复制数据库中的表格 新建一个新的表 所有属性。再添加属性
- 比Jquery FlexiGrid更好用 dotnetFlexGrid 1.2beta更新-增加展现模板模式(Grid中可以放编辑控件和任意Html内容了)
- [转] JavaScript 动态添加表格/动态添加事件/态设置属性
- 为MFC Grid Control 添加 button类型cell
- [原创]JavaScript动态添加表格行(使用模板、标记)
- Jquery实现简单的表格添加、编辑、删除教程
- GridView添加编辑模板
- js 中关于table表格的cell,row 的属性的操作
- 为MSHFlexGrid添加表格编辑功能
- SupeSite 7.0.0正式版运用在线模板编辑功能修改并添加站点模板
- extjs表格(Ext4 Grid)文本启用选择复制功能
- 在asp.net中,添加itemtempert 项模板时,如果在项模板里有其它控件,如何控件这些控件的属性?
- GridControl详解(附)表格属性一览
- 为MFC Grid Control 添加 button类型cell
- CListCtrl 添加CheckBox、整行选中、表格线属性代码
- JavaScript 动态添加表格行 使用模板、标记
- GridView鼠标移动到某一行时行发生变色和为Gridview中编辑模板中的控件添加颜色