怎么样按照MVC模式制作自定义控件?
前面我们完成了,表现和数据的功能,接着就是将他们使用在一个应用中了,这就需要一个控制器控制他们的数据逻辑,以及事件的顺序。先看一下代码
//JavaScriptDocumentMVC=C
functionassessmentListContrl(userName,assessmentID,cutScore){
varajaxobj=false;
this.userName=userName;
this.assessmentID=assessmentID;
this.cutScore=cutScore;
varObjSelf;
ObjSelf=this;
}
var_assessmentListContrl=newassessmentListContrl();
assessmentListContrl.prototype.build=_bulidassessmentListContrl;
function_bulidassessmentListContrl()
{
vardata=newassessmentListData(this.userName,this.assessmentID);
varASL=newassessmentList(this.cutScore);
data.callbackdata=function(xmlobj){
ASL.bulidAssessmentList(xmlobj,this.cutScore)
}
//下载状态
ASL.build();
}
functionassessmentListContrl(userName,assessmentID,cutScore){
varajaxobj=false;
this.userName=userName;
this.assessmentID=assessmentID;
this.cutScore=cutScore;
varObjSelf;
ObjSelf=this;
}
var_assessmentListContrl=newassessmentListContrl();
assessmentListContrl.prototype.build=_bulidassessmentListContrl;
function_bulidassessmentListContrl()
{
vardata=newassessmentListData(this.userName,this.assessmentID);
varASL=newassessmentList(this.cutScore);
data.callbackdata=function(xmlobj){
ASL.bulidAssessmentList(xmlobj,this.cutScore)
}
//下载状态
ASL.build();
}
本文地址:http://www.45fan.com/a/question/67179.html