Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8262839
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T03:53:14+00:00 2026-06-08T03:53:14+00:00

I have two very simple Spine.js controllers: class ListController extends Spine.Controller className: ‘list’ constructor:

  • 0

I have two very simple Spine.js controllers:

class ListController extends Spine.Controller
    className: 'list'
    constructor: () ->
        super

class DetailController extends Spine.Controller
    className: 'detail'
    constructor: () ->
        super

controller stack

class Application extends Spine.Stack
    className: 'mystack'
    controllers:
         list: ListController
         detail: DetailController

and corresponding HTML markup

<div class="mystack">
    <div class="list">list</div>
    <div class="detail">detail</div>
</div>

My problem is that when controller stack instantiated

app = new Application()
app.list.active()

there is no active class added to the div.list element. Divs remain unchanged.

What is wrong with that?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T03:53:17+00:00Added an answer on June 8, 2026 at 3:53 am

    I’ve just got it so I’ll describe basic working example. There are several issues with the code above (caused by my misunderstanding of how Spine.js controller stack works 🙂

    First, appropriate HTML element have to be associated with every controller managed by the stack. When controller stack instantiates the controller it passes only stack (i.e. itself) instance as parameter to the constructor. So controller constructor have to take it into account (e.g. like the following):

    class ListController extends Spine.Controller
        constructor: (parameters) ->
            @stack = parameters.stack
            @el = $ @stack.settings.listSelector
            super
    
    class DetailController extends Spine.Controller
        constructor: (parameters) ->
            @stack = parameters.stack
            @el = $ @stack.settings.detailSelector
            super
    

    and the stack:

    class Application extends Spine.Stack
        settings:
            listSelector: '.list'
            detailSelector: '.detail'
        controllers:
            list: ListController
            detail: DetailController
        default:
            'list'
    

    then the controller stack could be instantiated:

    app = new Application
        el: $ '.mystack'
    

    ListController will be active (i.e. corresponding div has active class added) by default and anytime later you can call @stack.detail.active() or @stack.list.active() from controller instance method to activate required controller and ‘hide’ (i.e. remove active class) the other(s).

    EDIT:
    We discussed the issue with @aschmid00. In fact, controller constructor doesn’t have to set its own property @stack manually. It is done automatically when base constructor called by super. But in case of this question @el have to be set before base constructor called due to the events delegation etc.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two very simple classes, one extends the other: public class LocationType implements
I have a very simple scenario, using NHibernate: one abstract base class animal; two
I have two very simple classes Submission and Store class Submission(models.Model): title = models.CharField(max_length=50,
I have a very simple object model with a base class Person and two
I have two very simple routes routes.MapRoute( post, // Route name postPage + /{slug},
I have two very simple, identical UITableViews in my app that are populated with
The situation is very simple, I have two panel. In the event of OnMouseOver
I have a very simple table with two columns, but has 4.5M rows. CREATE
I have a very simple database table that joins two other tables in a
I'm just trying to preform a very simple jQuery action. I have two components:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.