您的位置:首页 > 产品设计 > UI/UE

java easyui自定义拓展组件

2016-04-18 14:41 471 查看
//自定义拓展公共组件
/***************************************************
*******************  数据字典下拉框   *************
*
*        invalidFlag :  编码分类ID
*        filter      :  过滤器

*        */
$.parser.plugins.push("dictCtgbox");//注册扩展组件
$.fn.dictCtgbox = function (options, param) {//定义扩展组件

if (typeof options == "string") { return $.fn.combobox.apply(this, arguments); }
options = options || {};

return this.each(function () {
var jq = $(this);
//$.fn.combobox.parseOptions(this)作用是获取页面中的data-options中的配置
var opts = $.extend({}, $.fn.combobox.parseOptions(this), options);

$.get(webroot+'/xx/xxx/getAll',
{   invalidFlag :  0,
Id   :  jq.attr("dict-dictCtgId"),
filter      :  jq.attr("dict-filter")
},
function(reuslt){
var myopts = $.extend(true, {
data: jQuery.parseJSON(reuslt),
valueField: 'Id',
textField: 'text'
}, opts);
$.fn.combobox.call(jq, myopts);
});
});
};
<pre name="code" class="html">  <input class="easyui-dictCtgbox" dict-dictCtgId="" dict-domainId="" dict-dictCtgCode="1" dict-filter=""/>

                                            
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: