我不知道这是如何工作的,但是我需要在以下代码中放置一个if语句。我知道Javascript,但不知道余烬,我仍在学习中。我的文件名为:CatalogueListController.js,其中的代码包含在:
App.CataloguelistController = Em.ArrayController.extend(Ember.PaginationSupport, {
needs: ["search", "accountBrowse"],
content: [],
total: 0,
isLoading: false,
outofcount: 0,
searchquery: '',
classid: 0,
attributelist: '',
processguid: '',
quotetypeMetaBinding: "App.metaDataController.QUOTETYPE",
addToBulk: function(context) {
var self = this,
accountguid = App.selectedAccountGuid,
quotetype = (context && context.metacode) ? context.metacode : App.currentQuotetype,
itemArray = [];
//some more code here
},
//i need to put the if here if it is for a certain accountguid then have
currentViewList: true,
currentViewBulk: false,
//else have this
currentViewList: false,
currentViewBulk: true,
mainPage: false,
andOr: [
{"name": "Match All", "value": "AND"},
{"name": "Match Any", "value": "OR"}
],
andOrSelected: 'AND',
我在需要的地方加了注释。有什么帮助吗?谢谢
在init上有条件地设置这些属性:
App.CataloguelistController = Em.ArrayController.extend(Ember.PaginationSupport, {
init: function(){
this._super();
if(//somecondition){
this.set('currentViewList', true);
this.set('currentViewBulk', false);
}else{
// set them to something else..
}
}
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句