OSDN Git Service

fix profiler
[pettanr/pettanr.git] / app / assets / javascripts / locmare / profiler / association / has_many.js.coffee
index b6eef8b..913d6b7 100644 (file)
@@ -4,18 +4,17 @@ class Locmare.ProfilerModule.AssociationModule.HasMany extends Backbone.View
   initialize: (options) ->\r
     @association = options.association\r
     @has_many_manifest = options.has_many_manifest\r
-    @filer = null\r
-    m = new Pettanr.FilerCollection({}, @has_many_manifest.list_options(@item().get('id')))\r
-    _this = this\r
-    m.fetch().done ->\r
-      items = m.models\r
-      #_this.filer = new Locmare.Filer(_this.has_many_model().item_name, items, @pager, _this.profiler().operators)\r
-      _this.render()\r
+    c = @has_many_manifest.list_options(@item().get('id'))\r
+    m = new Pettanr.FilerCollection({}, c)\r
+    @filer = new Locmare.Filer({\r
+      item_name: @has_many_model().item_name(), \r
+      collection: m, \r
+      pager: @pager, \r
+      operators: @profiler().operators\r
+    })\r
   \r
   render: () ->\r
-    this.$el.html('')\r
-    if @filer\r
-      this.$el.html(@filer.render().el)\r
+    this.$el.html(@filer.el)\r
     this\r
   \r
   item: () ->\r