Adding DIVs dynamically to an M.ContainerView

21 views
Skip to first unread message

Gargi Das

unread,
Oct 30, 2013, 7:02:29 AM10/30/13
to themp...@googlegroups.com
Hi,

I am planning to write a custom control and use that in M Project, so i wanted to ask is there any way i can add divs to my M.ContainerView Object from JavaScript ??

Regards,
Gargi

hano

unread,
Nov 7, 2013, 7:21:48 AM11/7/13
to themp...@googlegroups.com
Hi Cargi,
what exactly do you mean when you say "from JavaScript". Do you mean at runtime?
I recommend to write a custom view that extends from M.ContainerView and implements another render function:

M.CargiView = M.ContainerView.extend({

  render: function(){
   this.html = '';
   this.html += '<div id="''+ this.id + " ' + this.style() + '><div><div><div><div>';
   this.html += this.renderChildViews();
   this.html += '</div></div></div></div></div>'
   return this.html;
  }

});

Hope this helps you.
best regards
marco

ps: Be patient didn't validate the source code

Gargi Das

unread,
Nov 7, 2013, 11:31:49 AM11/7/13
to themp...@googlegroups.com
thanks i was interested in that !!

Regards,
Gargi
Reply all
Reply to author
Forward
0 new messages