在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. linux 下使用crontab 定时打包日志并删除已被打包的日志

    crontab是和用户相关的,每个用户有自己对应的crontab . cron是Linux下的定时执行工具,以下是重启/关闭等等的命令 #/sbin/service crond start //启动服 ...

  2. CentOS7 查看ip

    查看内网:ip addr 查看公网:curl members.3322.org/dyndns/getip

  3. Lua脚本之语法基础快速入门

    要 1.基本数据类型 2.Lua中的常用语句结构以及函数 3.Lua中的常用语句结构介绍 4.Lua中的库函数 目录[-] 一.基本数据类型 二.Lua中的常用语句结构以及函数 1.Lua中的常用语句 ...

  4. this在JavaScript中的工作范围

    this在JavaScript中的工作范围 在一个函数中,this的行为,取决于JavaScript函数的调用方式和定义方式,而不仅仅是看它如何被定义的. var fullname = 'Fu';va ...

  5. javascript进阶——分离式DOM脚本编程

    编写分离式(unobstrusive)代码意味着对HTML内容的完全分离:数据来自服务器端,javascript代码用来动态化和交互.这种分离的好处是在不同浏览器之间使用是可以完全降级或升级运行,对于 ...

  6. org.springframework.dao.InvalidDataAccessApiUsageException: Write operations are not allowed in read-only mode

    [spring]:org.springframework.dao.InvalidDataAccessApiUsageException: Write operations are not allowe ...

  7. zoom 用法

    from: http://www.jb51.net/css/40285.html 其实Zoom属性是IE浏览器的专有属性,Firefox等浏览器不支持.它可以设置或检索对象的缩放比例.除此之外,它还有 ...

  8. Sublime Text 3之Package Control 安装

    1.通过快捷键 ctrl+` 或者 View > Show Console 打开控制台,然后粘贴以下安装代码: import urllib.request,os; pf = 'Package C ...

  9. 静态页面参数传递&回调函数写法&快速排序的实现方法

    相信很多人都有一种陋习,就是收藏的文章,几乎从来都没有回过头来仔细看过.这次借着这次活动的机会,在<无懈可击的web设计>一书的学习过程中,穿插着讲自己曾经收藏过的,现在觉得还有价值的文章 ...

  10. CSS3制作时钟

    这个效果是一个CSS3制作的时钟,不过并不是我们传统的时钟风格,分别用三块显示 时.分.秒三个部分,而且这个DEMO中藤藤还为其加上了一个js的效果,能让这个效 果和现实时钟的时间同步.这个效果运用到 ...