easyui grid 里的可编辑text 加清空图标
$.extend($.fn.datagrid.defaults.editors, {
text: {
init: function (container, options) {
var _opt = $('<input type="text" class="datagrid-editable-input">');
var curField = container.prevObject.prevObject.attr('field');
if (curField == "我们需要加清空的字段" ) {
var button = $('<input type="text" class="easyui-textbox"> ').appendTo(container);
button.textbox({
//添加清除图标
icons: [{
iconCls: 'icon-clear',
handler: function (e) {
button.textbox('clear');
//modelTextClear 是自定义清除 grid 里数据 的函数
modelTextClear(curField);
}
}]
});
if (typeof (options.onClick) == 'function') {
var el = button.next().children('.textbox-text');
el.click(function () {
options.onClick(el);
});
}
return button;
}
if (typeof (options.onChange) == 'function') {
_opt.change(function () {
options.onChange(_opt);
});
}
if (typeof (options.onFocus) == 'function') {
_opt.focus(function () {
options.onFocus(_opt);
});
}
if (typeof (options.onKeyup) == 'function') {
_opt.keyup(function () {
options.onKeyup(_opt);
});
}
var input = _opt.appendTo(container);
if (container.closest('td[field]').attr('field') == 'ApplyDate') {
_opt.addClass('form-control');
return input.datetimepicker({
minView: "month", //选择日期后,不会再跳转去选择时分秒
format: "yyyy-mm-dd", //选择日期后,文本框显示的日期格式
language: 'zh-CN', //汉化
autoclose: true
});
}else {
return input;
}
},
destroy: function (target) {
$(target).remove();
},
getValue: function (target) {
return $(target).val();
},
setValue: function (target, value) {
$(target).val(value);
},
resize: function (target, width) {
$(target)._outerWidth(width);
//以下是处理图标不显示的问题 因为span 占满了单元格
var curField = target.closest('[field]').attr('field');
if (curField == "ReimbursementID" || curField == "CostCenterDisplayName" || curField == "ProductDisplayName") {
target.next('.textbox').css('width', width);
target.next().children('.textbox-text').css('width', width - 26);
}
}
}
});
easyui grid 里的可编辑text 加清空图标的更多相关文章
- easy-ui grid里的toobar按钮隐藏与显示
//隐藏第一个按钮$('div.datagrid-toolbar a').eq(0).hide();//隐藏第一条分隔线$('div.datagrid-toolbar div').eq(0).hide ...
- ligerui_实际项目_003:form中添加数据,表格(grid)里面显示,最后将表格(grid)里的数据提交到servlet
实现效果: "Form"中填写数据,向本页"Grid"中添加数据,转换成Json数据提交,计算总和,Grid文本框可编辑,排序 图片效果: 总结: //disp ...
- easyui grid 增加合计行
一.首先,easyui grid 的 showfooter 属性设置为 true $aplgrid.datagrid({ data: globalExpenseClaimForm.ExpenseCl ...
- 问题-[Delphi]在对GRID设置单击为编辑时,其他GRID可以,但有一个GRID不行?
问题现象:在对GRID设置单击为编辑时,其他GRID可以,但有一个GRID不行?问题原因:在这个GRID中的单击事件可能不存在,可以测试一下有没有单击事件.解决方法:需要在GRID的上一个类中,放开单 ...
- jQuery EasyUI动态添加控件或者ajax加载页面后不能自动渲染问题的解决方法
博客分类: jquery-easyui jQueryAjax框架HTML 现象: AJAX返回的html无法做到自动渲染为EasyUI的样式.比如:class="easyui-layout ...
- easyui datagrid里的复选框置灰方法
easyui datagrid里的复选框置灰方法: $('.datagrid input').prop('disabled',true);//复选框置灰
- EasyUI datagrid 明细表格中编辑框 事件绑定 及灵活计算 可根据此思路 扩展其他
原创 : EasyUI datagrid 明细表格中编辑框 事件绑定 及灵活计算 可根据此思路 扩展其他 转载,请注明出处哦!谢谢! 原创 : EasyUI datagrid 明细表格中编辑框 事件绑 ...
- easyui grid 本地做分页
背景: 有的数据不是很多,但是有分页的需求,这个时候后台往往没有做分页,我们是一次请求了所有的数据. 代码: dataSource 为 grid 里的数据源 html部分: <table id= ...
- ExtJs 日期相加,Grid表格列可编辑
1.日期相加: Ext.Date.add(new Date(), Ext.Date.DAY, 15) 2.Grid表格列可编辑: { header : "实际已交货量", ...
随机推荐
- The model backing the 'XXX' context has changed 错误
https://blog.csdn.net/hit_why/article/details/72778785 https://blog.csdn.net/hit_why/article/details ...
- git克隆和上传项目
软件环境: 1. VS2017 2. Git ver 2.17.0.1 3. gitee.com 目的: 已有的本地项目(新建)上传到码云,使本地可以和码云同步 尝试: 先在码云上建立项目,项目名称和 ...
- HDU 5442 后缀自动机(从环字符串选定一个位置 , 时针或顺时针走一遍,希望得到字典序最大)
http://acm.hdu.edu.cn/showproblem.php?pid=5442 题目大意: 给定一个字符串,可理解成环,然后选定一位置,逆时针或顺时针走一遍,希望得到字典序最大,如果同样 ...
- DataGridView绑定list的注意事项
1.DataGridView数据绑定对比(DataTable与泛型List): 当DataGridView的DataSource是DataTable的时候,DataTable的数据改变时, ...
- redis 网络库文件 重构
https://blog.csdn.net/yangbodong22011/article/details/65444273 相关博客 https://blog.csdn.net/tanswer_/a ...
- python入门练习之如何连接数据库
!/usr/bin/python -- coding: UTF-8 -- author = 'luke' from sqlalchemy import create_engine from sqlal ...
- proxy写监听方法,实现响应式
var data = { price: 5, quantity: 2 };var data_without_proxy = data; // 保存源对象data = new Proxy(data_wi ...
- openerp学习笔记 domain 的应用
1.在Action中定义,domain用于对象默认的搜索条件: 示例: <record id="action_orders" model="ir.actions.a ...
- mysql故障总结
MYSQL故障排查 https://zhuanlan.zhihu.com/p/27834293
- jQuery插件的开发(一)
jQuery插件的开发包括两种: 一种是类级别的插件开发,即给jQuery添加新的全局函数,相当于给jQuery类本身添加方法.jQuery的全局函数就是属于jQuery命名空间的函数,另一种是对象级 ...