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

    效果:

  • 相关阅读:
    Eclipse 中使用 ctrl 无法追踪函数的问题
    AJAX跨域问题
    eclipse设置svn代理
    同步IO和异步IO
    阿里云配置redis
    Centos +django+nginx
    Centos 安装nginx
    django 给前端传递HTML内容
    django项目初探
    python邮件服务
  • 原文地址:https://www.cnblogs.com/Johnzhang/p/3248488.html
Copyright © 2011-2022 走看看