jQuery MiniUI

 找回密码
 立即注册
查看: 1705|回复: 3
打印 上一主题 下一主题

set方法关于columns的函数绑定 [复制链接]

Rank: 3Rank: 3

跳转到指定楼层
楼主
发表于 2016-10-14 15:37:02 |只看该作者 |倒序浏览

grid.set({
        columns: [
            { type: "indexcolumn" },
            { field: "loginname", width: 120, headerAlign: "center", allowSort: true, header: "员工账号", editor: { type: "textbox", minValue: 0, maxValue: 200, value: 25} },
            { field: "age", width: 100, headerAlign: "center", allowSort: true, header: "年龄", editor: { type: "spinner"} },
            { field: "birthday", width: 100, headerAlign: "center", dateFormat: "yyyy-MM-dd H:mm", allowSort: true, header: "生日", editor: { type: "datepicker"} },
            { field: "remarks", width: 120, headerAlign: "center", allowSort: true, header: "备注", editor: { type: "textarea"} },
            { field: "gender", type: "comboboxcolumn", autoShowPopup: true, width: 100, headerAlign: "center", header: "性别", editor: { type: "combobox", data: Genders} },
            { field: "country", type: "comboboxcolumn", width: 100, headerAlign: "center", header: "国家", editor: { type: "combobox", url: "../data/countrys.txt"} },
            { field: "married", trueValue: 1, falseValue: 0, type: "checkboxcolumn", width: 60, headerAlign: "center", header: "婚否" }
        ]
    });

http://www.miniui.com/docs/api/index.html#ui=listbox

请教各位,这样构造出来的datagrid怎么给combobox列添加事件?比如我要在选择性别为男后alert(1),该怎么实现呢?

附件: 你需要登录才可以下载或查看附件。没有帐号?立即注册

Rank: 8Rank: 8

沙发
发表于 2016-10-14 16:28:01 |只看该作者
  1. var flag = false;
  2. grid.on("cellbeginedit", function (e) {
  3.     if (e.field == "gender") {
  4.         if (!flag) {
  5.             e.editor.on("valuechanged", function (e) {
  6.                 alert(e.value);
  7.             })
  8.             flag=true
  9.         }
  10.     }
  11. })
复制代码


Rank: 3Rank: 3

板凳
发表于 2016-10-16 19:55:44 |只看该作者
dforce 发表于 2016-10-14 16:28

请问版主,grid.set({})都能接收哪些参数啊?columns,data...API手册里面没有找到关于这个函数的具体说明啊,还有就是grid.on()都能接收哪些参数啊?有相关的文档吗?我的目的是只用JS就实现页面的渲染,这样可以提高页面的复用性,但没有找到具体的API以及示例,麻烦版主提供一下意见吧

Rank: 8Rank: 8

地板
发表于 2016-10-17 10:15:07 |只看该作者
三点水 发表于 2016-10-16 19:55
请问版主,grid.set({})都能接收哪些参数啊?columns,data...API手册里面没有找到关于这个函数的具体说明 ...

http://www.miniui.com/docs/api/index.html#ui=datagrid
set是js设置属性
on是绑定事件

Archiver|普加软件

GMT+8, 2024-9-20 00:42 , Processed in 1.044434 second(s), 10 queries .

Powered by Discuz! X2

© 2001-2011 Comsenz Inc.

回顶部