Quantcast
Channel: JavaScriptMVC Forum
Viewing all articles
Browse latest Browse all 3491

controller not executed after a recall

$
0
0
Hi, I am working on a website right now that use 1 controller that display a content manufactured by a widget controller. The Widget is called when you click on an element it works once but when you click again nothing is displayed. I think the controller is not executed the second time only the first. Can someone tell me how to avoid that kind of problem ? How to execute plenty of time this controller ?
Thank you.
  1. steal(
  2.     '//models/personal_area.js',
  3. '//controllers/widgets/moments_list.js',
  4. '//controllers/widgets/followers.js',
  5. '//controllers/widgets/followings.js',
  6.     function() {
  7.         $.Controller('PersonalAreaController',{
  8.             defaults : {
  9.              userId : 0
  10.             }
  11.         },
  12.         {
  13.             init : function(el, opt) {
  14.                 PersonalArea.findAll({
  15.                     userId : opt.userId
  16.                 },
  17.                 function(models) {
  18.                     el.append('//views/personal_area.ejs', models);
  19.                 });
  20.             },
  21. '#button_2 click' : function(el,ev) {
  22. var classP = "";
  23. classP = el.attr('class').substr(11);
  24. $(".moments_list").html('');
  25. $('#momentsList').moments_list({ 
  26. selectedCategoryId : classP,
  27. isNotClicked : [true, true, false, true, true],
  28. isDark : 2,
  29. areaInit : true,
  30. superInit : false
  31.  });
  32. },
  33.         }); 
  34.     }
  35. );

  36. steal(
  37. '//controllers/modules/continuous_list.js',
  38. '//models/the_moments.js',
  39.     '//controllers/widgets/moments.js',
  40.     '//controllers/at_a_glance.js'
  41. ).then(function() {
  42.         ContinuousListController('MomentsListController',{
  43.             defaults : {
  44. params : {},
  45. DarkColor : [],
  46. clearColor : [],
  47. height : [40, 36, 32, 28, 28],
  48. template : '//views/moments_list.ejs',
  49. models : null,
  50.                 prevId : 0,
  51. userId : 0,
  52. init : true,
  53. triangleInit : true,
  54. selectedCategoryId : 'all',
  55. momentsBackUpCount : 0,
  56. momentsCount : 0,
  57. momentsLimit : 32,
  58. modelBackUp : [],
  59. category : [],
  60. isNotClicked : [true, true, true, true, true],
  61. isDark : 10,
  62. areaInit : false,
  63. superInit : true
  64.             }
  65.         },{
  66.             init : function(el, opt) {
  67.                 var _this = this;
  68.  
  69.  this.load();
  70.               this.options.params.prevId = this.options.prevId;
  71.  
  72.  
  73.  if(this.options.superInit){ 
  74. this._super(); // ContinuousListController.init
  75. this.options.superInit = true
  76.  }
  77.             },

  78.             load : function() {
  79.                 var _this = this;
  80.                 var models;
  81. TheMoments.findAllByTimeline(this.options.params, function(models) {
  82. _this.options.models = models;
  83. if(_this.options.momentsCount==0){
  84. _this.options.category = models.category;
  85. _this.options.modelBackUp = models;

  86. _this.options.momentsCount = models.length;
  87. }else{
  88. _this.options.momentsCount = models.length;
  89. _this.options.momentsBackUpCount = _this.options.modelBackUp.length;
  90. for(var i = 0; i < models.length; i++){
  91. _this.options.modelBackUp[_this.options.momentsCount+i] = models[i];
  92. }
  93. }
  94. _this.appendMomentsList();
  95. _this.categorySelect();
  96. });


  97.             }, ...

Viewing all articles
Browse latest Browse all 3491

Trending Articles