0
塊1:如預期,但是當 「SelectIndustry」 是從稱爲第3座 * this.query未定義 initialize方法工作得很好 *復位收集
ComplienceCollection = Backbone.Collection.extend({
model: Complience,
initialize: function() {
_.bindAll(this, 'selectFeaturesCallback');
vent.bind("onSelectIndustry", this.SelectIndustry);
if(industrylookup == null)
{
industrylookup = "http://hostname/ArcGIS/rest/services/sss/MapServer/2?f=json";
}
this.queryTask = new esri.tasks.QueryTask(industrylookup);
dojo.connect(this.queryTask, 'onComplete', this.selectFeaturesCallback);
this.query = new esri.tasks.Query();
this.query.returnGeometry = false;
this.query.where = '1=1';
this.query.outFields = ['*'];
this.queryTask.execute(this.query);
},
selectFeaturesCallback: function (featureSet) {
var item=_.pluck(featureSet.features, "attributes");
this.reset(item);
},
SelectIndustry: function (oid) {
this.query.where = '1=1';
this.queryTask.execute(this.query);
}
});
2座: 這就是所謂的與其他骨幹網功能
vent = _.extend({}, Backbone.Events);
complienceList = new ComplienceCollection();
頁面加載3座: 從普通調用javascript文件
vent.trigger("onSelectIndustry",indutrytype);
嘗試將其綁定到SelectIndustry。 _.bindAll(this,'SelectIndustry'); – Konza