I add dependForm and dependFields attributes to field collegeCode.
<form id="courseListForm" method="post">
<input class="easyui-combobox" id="collegeCode" name="collegeCode" style="width:250px"
multiple="multiple" valueField="code" textField="shortName"
url='${appPath}/college/collegeListData.do'/>
<input class="easyui-combobox" id="collegeCode" name="collegeCode" style="width:250px"
multiple="multiple" dependForm="courseListForm" dependFields="termCode" valueField="code" textField="shortName"
url='${appPath}/college/collegeListData.do'/>
other fields...
</form>
after parser onComplete , I call the Component's extParse method if exits
$.parser.onComplete= function(context){
for(var i=0; i<$.parser.plugins.length; i++){
var name = $.parser.plugins[i];
var r = $('.easyui-' + name, context);
if (r.length){
if (r[name]&&r[name].methods.extParse){
r[name]('extParse');
}
}
}
}
then i extend an method to combobox
$.extend($.fn.combobox.methods, {
extParse: function(jq){
jq.each(function(){
var _this = $(this);
//default value
var defaultExtOptions = {
dependForm:null,
dependFields:null,
};
//markup value
var markupOptions = {
dependForm:_this.attr('dependForm'),
dependFields:_this.attr('dependFields'),
};
//megre extOptions
var extOptions = $.extend(defaultExtOptions,markupOptions);
if(extOptions.dependFields){
//register event
var dependFields = extOptions.dependFields.split(',');
for(var i in dependFields){
//**************************************************
$('#'+dependFields[i]).textbox('options').onChange=function(){
_this.combobox('reload');
};
}
}
if(extOptions.dependForm){
_this.combobox({
onBeforeLoad: function(param){
var formData = $("#"+extOptions.dependForm).formToObject();
$.extend(param,formData);
}
});
}
});
}
});
the line below many '*****',have errors,so the question is :
combobox extends combo
combo extends textbox.
can i call the parent's 'options' method to get the current options ?
because i can't know ,what the depended component type is