验证密码:
$.extend($.fn.validatebox.defaults.rules, {
eqPwd : {
validator : function(value, param) {
return value == $(param[0]).val();
},
message : '密码不一致!'
}
});
使用如下:
<tr><span style="white-space:pre"> </span>
<span style="white-space:pre"> </span><td>密 码:</td>
<span style="white-space:pre"> </span><td><input type="password" name="user.userPwd" class="easyui-validatebox" id="pwd"
data-options="required:true,missingMessage:'请输入密码!'" /></td>
</tr>
<tr>
<span style="white-space:pre"> </span><td>确认密码:</td>
<td><input type="password" class="easyui-validatebox"
data-options="required:true,missingMessage:'请确认密码!',validType:'eqPwd[\'#pwd\']'" /></td>
</tr>
$.fn.tree.defaults.loadFilter = function(data, parent) {
var opt = $(this).data().tree.options;
var idFiled, textFiled, parentField;
if (opt.parentField) {
idFiled = opt.idFiled || 'id';
textFiled = opt.textFiled || 'text';
parentField = opt.parentField;
var i, l, treeData = [], tmpMap = [];
for (i = 0, l = data.length; i < l; i++) {
tmpMap[data[i][idFiled]] = data[i];
}
for (i = 0, l = data.length; i < l; i++) {
if (tmpMap[data[i][parentField]] && data[i][idFiled] != data[i][parentField]) {
if (!tmpMap[data[i][parentField]]['children'])
tmpMap[data[i][parentField]]['children'] = [];
data[i]['text'] = data[i][textFiled];
tmpMap[data[i][parentField]]['children'].push(data[i]);
} else {
data[i]['text'] = data[i][textFiled];
treeData.push(data[i]);
}
}
return treeData;
}
return data;
};
加载树的具体使用:
$('#travel_menuTree').tree({
url : '${pageContext.request.contextPath }/menuAction!getTravelMenu.action',
parentField : 'pid',
animate : 'true',
lines : 'true',
onClick : function(node) {
if (node.attributes.url != null) {
addTab({
title : node.text,
closable : true,
iconCls : node.iconCls,
href : '${pageContext.request.contextPath}' + node.attributes.url
});
}
}
});
下拉树和树的方法相同,只需加载树的方法该为combotree即可
防止对话框超出浏览器的方法
var easyuiPanelOnMove = function(left, top) {
var width = parseInt($(this).parent().css('width')) + 14;
var height = parseInt($(this).parent().css('height')) + 14;
var right = left + width;
var buttom = top + height;
var browserWidth = $(window).width();
var browserHeight = $(window).height();
if (right > browserWidth) {
left = browserWidth - width;
$(this).window('move', {
left : left
});
}
if (buttom > browserHeight) {
top = browserHeight - height;
$(this).window('move', {
top : top
});
}
if (left < 0) {
left=1;
$(this).window('move', {
left : left
});
}
if (top < 0) {
top=1;
$(this).window('move', {
top : top
});
}
};
$.fn.panel.defaults.onMove = easyuiPanelOnMove;
$.fn.window.defaults.onMove = easyuiPanelOnMove;
$.fn.dialog.defaults.onMove = easyuiPanelOnMove;