jQuery MiniUI

标题: set方法关于columns的函数绑定 [打印本页]

作者: 三点水    时间: 2016-10-14 15:37:02     标题: set方法关于columns的函数绑定


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[attach]8124[/attach]怎么给combobox列添加事件?比如我要在选择性别为男后alert(1),该怎么实现呢?


作者: dforce    时间: 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. })
复制代码



作者: 三点水    时间: 2016-10-16 19:55:44

dforce 发表于 2016-10-14 16:28

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




欢迎光临 jQuery MiniUI (http://miniui.com/discuss/) Powered by Discuz! X2