在JQueryEasyUI中为DataGrid自定义了一个ComboGrid编辑器。具体方法:
自己写一个扩展 $.extend($.fn.datagrid.defaults.editors, {
combogrid: {
init: function (container, options) {
var input = $('<input type="text" class="datagrid-editable-input">').appendTo(container);
input.combogrid(options);
return input;
},
destroy: function (target) {
$(target).combogrid('destroy');
},
getValue: function (target) {
return $(target).combogrid('getValue');
},
setValue: function (target, value) {
$(target).combogrid('setValue', value);
},
resize: function (target, width) {
$(target).combogrid('resize', width);
}
}
}); 定义DataGrid <table id="tt1" class="easyui-datagrid" singleselect="true" idfield="MaterialReceivedEntryID"
fit="true" striped="true" rownumbers="true" fitcolumns="true" showfooter="true">
<thead>
<tr>
<th field="ItemID" width="80"
formatter = "itemFormatter"
editor="{
type: 'combogrid', options: {
required: true, panelWidth:260, fitColumns:true,
idField:'ItemID', textField:'Code',
url:'<%= Html.AttributeEncode(Url.Action("GetRMItems", "Item")) %>',
columns:[[
{ field: 'Code', title: '物料代码', width: 80 },
{ field: 'Material', title: '材质', width: 80, align: 'center'},
{ field: 'Diameter', title: '直径', width: 60, align: 'center' }
]],
onSelect:function(rowIndex, rowData) {
$('#tt1').datagrid('updateRow', {
index: _lastIndex, row: {
Material: rowData.Material,
Diameter: rowData.Diameter } })
}
}
}">
原材料代码
</th>
<th field="Material" width="80" align="center">
材质
</th>
<th field="Diameter" width="60" align="center">
直径(mm)
</th>
<th field="Long" width="60" align="center" editor="{ type: 'numberbox', options: { required: true}}">
长度(mm)
</th>
<th field="ReceivedQty" width="60" align="center" editor="{ type: 'numberbox', options: { required: true}}">
根数(PCS)
</th>
<th field="Weight" width="60" align="center" editor="{ type: 'numberbox', options: { required: true, precision: 3}}">
重量(T)
</th>
<th field="HeatNumber" width="100" align="center" editor="{ type: 'validatebox', options: { required: true}}">
炉号
</th>
<th field="Remark" width="80" align="center" editor="text">
备注
</th>
</tr>
</thead>
</table> 最后别忘了那个Formatter function itemFormatter(value, row) { ... ... }

Extend ComboGrid Editors for DataGrid Of JQuery EasyUI的更多相关文章

  1. jquery easyui datagrid 加载保存好的自定义设置的列属性

    直接附上源代码 <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <t ...

  2. jQuery EasyUI之DataGrid使用示例

    jQuery EasyUI是一个轻量级的Web前端开发框架,提供了很多的现成组件帮助程序员减轻前端代码开发量,之前有个项目中就用到了其中的DataGrid. jQuery EasyUI框架的官方主页: ...

  3. Build CRUD Application with jQuery EasyUI

    http://www.jeasyui.com/tutorial/app/crud.php It has become a common necessily for web application to ...

  4. jQuery EasyUI API - Grid - DataGrid [原创汉化官方API]

    最近在学习jQuery EasyUI,发现中文的文档好少,部分文档不错但它是鸟语的,为了大家也为了自己学习吧,汉化做一下笔记. 有没有说清楚的,或者翻译不正确的地方还请大家谅解指出.. 由于工作时间原 ...

  5. 扩展jquery easyui datagrid编辑单元格

    扩展jquery easyui datagrid编辑单元格 1.随便聊聊 这段时间由于工作上的业务需求,对jquery easyui比较感兴趣,根据比较浅薄的js知识,对jquery easyui中的 ...

  6. jQuery EasyUI教程之datagrid应用

    一.利用jQuery EasyUI的DataGrid创建CRUD应用 对网页应用程序来说,正确采集和管理数据通常很有必要,DataGrid的CRUD功能允许我们创建页面来列表显示和编辑数据库记录.本教 ...

  7. 第二百二十二节,jQuery EasyUI,DataGrid(数据表格)组件

    jQuery EasyUI,DataGrid(数据表格)组件 学习要点: 1.加载方式 2.分页功能 本节课重点了解 EasyUI 中 DataGrid(数据表格)组件的使用方法,这个组件依赖于 Pa ...

  8. jQuery EasyUI - 数据表格(DataGrid)

    由于工作需要,项目使用前端 jQuery EasyUI - DataGrid 来控制数据表格. 1.加载相关js和css,因为easyui依赖jquery,所有加载easyui前要先加载jquery, ...

  9. JQuery easyUi datagrid 中 自定义editor作为列表操作按钮列

    转自   http://blog.csdn.net/tianlincao/article/details/7494467 前言 JQuery easyUi datagrid 中 使用datagrid生 ...

随机推荐

  1. STL简介

    由于不同书籍和翻译问题对STL中的术语可能有差别本文采用侯杰<STL源码剖析>中的术语 STL的组件 包含6个组件,分别为容器.算法.迭代器.仿函数(函数对象).配接器(适配器).配置器( ...

  2. 九度OJ 1209 最小邮票数 -- 动态规划

    题目地址:http://ac.jobdu.com/problem.php?pid=1209 题目描述: 有若干张邮票,要求从中选取最少的邮票张数凑成一个给定的总值.     如,有1分,3分,3分,3 ...

  3. top每个参数的意义

    上图来源于本人虚拟机,作为每个参数解释的参考 10:32:20:现在的时间 up 1 min : 服务器运行的时长 1 user:现在只有1个用户登录 load average: 0.74, 0.25 ...

  4. jQuery—一些常见方法(3)【width(),innerWidth(),outerWidth()】

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  5. 003.XE3包含了TPerlRegEx的单元

    使用'|'替换所有的内容 代码: program Project1; {$APPTYPE CONSOLE} uses System.SysUtils, System.RegularExpression ...

  6. Python 基础篇:数据类型、数据运算、表达

    1. 数据类型 1.1 数字 int(整型) 在32位机器上,整数的位数为32位,取值范围为-231-231-1,即-2147483648-2147483647 在64位系统上,整数的位数为64位,取 ...

  7. Python之路----文件操作

    文件操作 1.能调用方法的一定是对象,比如数值.字符串.列表.元组.字典,甚至文件也是对象,Python中一切皆为对象. str1 = 'hello' str2 = 'world' str3 = ' ...

  8. Python3.4 多线程

    线程安全和全局解释器锁 Thread State and the Global Interpreter Lock 总结: 通过使用GIL后, Python多线程安全, 并且数据保持同步. Python ...

  9. JAVA String 类

    java String类中的常用方法:public char charAt(int index)返回字符串中第index个字符:public int length()返回字符串的长度:public i ...

  10. SaveFileDialog控件

    http://msdn.microsoft.com/zh-cn/library/system.windows.forms.savefiledialog.aspx 1,SaveFileDialog控件的 ...