这个玩意的问题还真多, 但是控件也丰富 所以决定用做事.
以下记录问题:
变态级别问题:
1. 一定要用id, 看api的方法,感觉可以抛弃用id的时候, 确碰到很多问题
比如:
$('#select_company_product_order_pri').numberbox({ onChange:function(newValue,oldValue){ alert(1); } });
这里没问题, 但是如果你jquery去查询dom不使用id的话, 问题会让你压抑, 简直要疯掉.
$('input[name=select_company_product_order_pri]').numberbox({ onChange:function(newValue,oldValue){ alert(1); } });
上面这个代码, 是去掉id 用name来做, 但是会有问题, 会把你逼疯的.
所以记住: 用easyui就一定要给空间想好唯一的id, 否则会发疯的.
一般问题:
1. 获得更新的行. 问题: http://www.debugease.com/javascript/3508772.html
但是无法解决问题, 然后跟踪代码,发现acceptChanges方法里面调用的一段代码是
function _698(_699) { var _69a = $.data(_699, "datagrid"); var data = _69a.data; var rows = data.rows; var _69b = []; for (var i = 0; i < rows.length; i++) { _69b.push($.extend({}, rows[i])); } _69a.originalRows = _69b; _69a.updatedRows = []; _69a.insertedRows = []; _69a.deletedRows = []; }
Pandy: 这里在acceptChanges方法的时候被执行到,同时下面的代码数组已经被清空,所以无法getChanges获得数据, 因为下面清空数组引起的, 无法看出这个方法是用来干嘛, 但是清空了数组引起了问题, 先临时注释掉, 如果有问题, 再说啦.
2.表单 验证, 参考: jQueryEasyUi验证 http://uule.iteye.com/blog/1849690
3.表格验证: 定义列的时候, editor要这样写:
{field: 'addr', title: '地址', width: 200, editor: { type: 'validatebox', options: { required: true, validType: ['length[2,5]'] } }},
validType: 'email','equals['#pwd']','minLength[5]','url',['email','length[0,20]'](组合)等等, 更多信息参考上面.
文档里面描述: Indicate the edit type. When string indicates the edit type, when object contains two properties:
type: string, the edit type, possible type is: text,textarea,checkbox,numberbox,validatebox,datebox,combobox,combotree.
options: object, the editor options corresponding to the edit type.
但好像支持验证的, 只能是validatebox,combobox,numberbox,datebox(不确定), 其中text,textarea不支持验证, 很奇怪吧.
Dilaog剧中问题: http://blog.csdn.net/guoguo19811025/article/details/11560079
DataGrid Filter Row问题: , 一定要在$(document).ready(function(){....在这里实现...}); 其中file code列表: nofilter,contains,equal,,notequal,beginwith,endwith,less,lessorequal,greater,greaterorequal.
事件和方法:
方法: $('#order_no').textbox("setValue",no);
事件: $('#getCompanyProvideType').combobox({onSelect:function(){
alert(1);
}});
多个下拉框使用onSelect事件,会有一些下拉框失效.
改变DataGrid 行背景颜色, easyUI 根据一些条件改变DataGrid 行背景颜色 http://blog.csdn.net/yanghongchang_/article/details/7854103
表格PAI:居然不提供直接获得某一行的方法?很好奇.....
DataGrid Buffer View,虽然这个很迷人的功能,但是会有问题,如果有1行自动换行之后,就有问题。
jquery easyui datagrid的 getSelections问题 http://jabbar2011.iteye.com/blog/1661608,我的问题是想初始化的时候自动设定一些行,但是没有keyId,所以无法让某些行不设定,变换用idnex来做,formatter的时候存在这个index参数。selectRow,selectRecord,即使用selectRow方法。
自己的办法:
1.不过后来看到源码,只要设定返回的行的一个属性checked=true,就可以自动打勾了,不过不要太开心,因为选择样式没有自动加上去,太变态了。还是老老实实selectRow。
2.因为它的index是0开始,所以直接在onLoadSuccess事件里面处理,反正这个方法的参数data.rows就是数据。index的值也可以当作是rows的下标,前提是不能排序,刚好我也不使用排序。