Why is everyone still building parent-child views using the rendering method?

I dare call myself a hacker hacker. I know what infrastructure can do and where its limitations are. I also have some experience with multiple template templates.

I saw a lot of tutorials in which people explain how to create complex and nested views, and most of them construct it partially partially using templates, and then inside the parent view's rendering method to combine the template child views

It makes no sense to me why you need to deal with rendering the layout in declarative code. Coming from Flex, I was taught never to do this. I always left descriptions of the layout and binding of variables to the markup, and then processing the events in declarative (View instance) code that uses this markup.

However, no template templates that I tested allow you to create complex markup with nested views. You cannot call a template from a template and thereby create an instance of the View object. This seems technically possible, especially using data attributes, where we could specify type names.

Then, the entire rendering method of the class class of the root class of the View class should turn this template into HTML markup, and then figure out what types of child objects should be, create an instance of the child view for any of them, and continue if these child objects must have child objects. Each view is provided with a model context. Basically, all the template steps that we deal with all the time, but automated at the Backbone.View level.

Does anyone else think about this? Why doesn't anyone seem to be using this?

+5
source share
2 answers

, , . CSS (. ).

, Backbone, "" . .

http://github.com/derickbailey/backbone.modelbinding

, -. DOM . , - . , jQuery, ( , , IE8).

+1

, render . , , :

var childCollection = someLogicToCreateTheChildCollection();

new ChildView({
  collection : childCollection
});

, , , initialize, render. DOM.

, , DOM (, , ) - DOM setElement().render() .

+1

All Articles