Click here to Skip to main content
15,887,485 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more: , +
I have two templates (Header and Details) - Header contains some details and also on place holder for Details sections - Details contain some more details.
My problem is when i run application it will not replace Details template inside the placeholder of the Header.
View 1
C#
var CalendarView = Backbone.View.extend({
        el: '#header',
        model: todo,
        initialize: function () {
            this.render();
            this.monthView = new MonthView({ el: "#dvDetail", model: this.model });
        },
        render: function () {
            template.render("testHeader.htm", $(this.el), { data: this.model.toJSON() });
        }
    });

View 2
C#
var MonthView = Backbone.View.extend({
    initialize: function () {
        this.model.bind("change", this.render, this);
        this.render();
    },
    render: function () {
        template.render("testDetail.htm", $(this.el), { data: this.model.toJSON() });
    }
});

index.html
XML
<div id="header"></div>

testHeader.htm
XML
<div>This is header </div>
<div id="dvDetail">Sub template should be replace here...</div>

testDetail.htm
XML
<div>This is details template and replaced on #dvDetail html</div>

When i run the application it will display
This is header
Sub template should be replace here...

I would require

This is header
This is details template and replaced on #dvDetail html

Can any body let me know what was missing in this code to get desired output? Any clue would be highly appreciated!
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900