前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >easyuidatagrid扩展--玩一下,无实际意义

easyuidatagrid扩展--玩一下,无实际意义

作者头像
Jerremy
发布2022-05-09 14:41:19
1570
发布2022-05-09 14:41:19
举报
文章被收录于专栏:Puppeteer学习

直接上代码

代码语言:javascript
复制
 1 $.extend($.fn.datagrid.defaults.editors, {
 2     operater: {
 3         init: function (container, options) {
 4             var a1 = $("<a class='easyui-linkbutton' iconCls='icon-ok' plain='true' onclick='alert()' >更新</a>").appendTo(container);//初始化编辑器并返回目标对象。
 5             a1.linkbutton(options);
 6             var a2 = $("<a class='easyui-linkbutton' iconCls='icon-cancel' plain='true' onclick='alert(this)'>取消</a>").appendTo(container);
 7             a2.linkbutton(options);
 8             return container;
 9         },
10         getValue: function (target) {
11             return $(target);
12         },
13         setValue: function (target, value) {
14             $(target).val(value);
15         },
16         resize: function (target, width) {
17             var input = $(target);
18             if ($.boxModel == true) {
19                 input.width(width - (input.outerWidth() - input.width()));
20             } else {
21                 input.width(width);
22             }
23         }
24     }
25 })
代码语言:javascript
复制
使用:
代码语言:javascript
复制
 1 $(function () {
 2             $('#tt').datagrid({
 3                 url: 'Handler.ashx',
 4                 columns: [[
 5                     { field: 'productid', title: '产品编号', width: 300, editor: "text" },
 6                     { field: 'productname', title: '产品名称', width: 300, editor: "text" },
 7                     { field: 'operation', title: '操作', width: 200, editor: "operater" }
 8                 ]],
 9                 onDblClickRow: function (rowIndex, rowData) {
10                     $("#tt").datagrid('beginEdit', rowIndex);
11                  12                 }
13             });
14 
15         })

效果:

本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2013-08-09,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档