zoukankan      html  css  js  c++  java
  • easyuidatagrid扩展--玩一下,无实际意义

    直接上代码

     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 })


    使用:
     1 $(function () {
     2             $('#tt').datagrid({
     3                 url: 'Handler.ashx',
     4                 columns: [[
     5                     { field: 'productid', title: '产品编号',  300, editor: "text" },
     6                     { field: 'productname', title: '产品名称',  300, editor: "text" },
     7                     { field: 'operation', title: '操作',  200, editor: "operater" }
     8                 ]],
     9                 onDblClickRow: function (rowIndex, rowData) {
    10                     $("#tt").datagrid('beginEdit', rowIndex);
    11                  12                 }
    13             });
    14 
    15         })

    效果:

  • 相关阅读:
    PHP面试题4
    php面试题2
    php基础面试题1
    mysql添加索引命令
    lnmp初步学习知识整理
    代码运行的自由
    Lein droid
    关于Domain Sepcific Lang
    JavaScript倒计时类
    三国小记
  • 原文地址:https://www.cnblogs.com/Johnzhang/p/3248488.html
Copyright © 2011-2022 走看看