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 7163461
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T13:54:25+00:00 2026-05-28T13:54:25+00:00

I use spine.js in conjunction with the Spine.Ajax Module to load stuff via JSON

  • 0

I use spine.js in conjunction with the Spine.Ajax Module to load stuff via JSON from the Server. I’ve probably run into some syncronisation problem. I have a sidebar which just binds to the refresh and change events and then is rendered:

Survey.bind 'refresh change', @render

I also have set up some routes, which display a survey when the user accesses it via #/survey/:id. This is my controller:

class App.Surveys extends Spine.Controller
  className: 'surveys'

  constructor: ->
    super

    @append(@sidebar = new App.Sidebar)       # Sidebar to select surveys
    @append(@surveys = new App.SurveysStack)  # Show survey details survey

    @routes
     '/surveys/:id': (params) ->
       @sidebar.active(params)
       @surveys.show.active(params)

    Survey.fetch()

As you see, Survey.fetch() is called after the initialization, which does not pose a problem to the sidebar. However, it seems, that it poses a problems to the surveys Show controller (which is called by a Spine.Stack called App.SurveyStack):

class Show extends Spine.Controller
  constructor: ->
    super
    @active @change

  change: (params) =>
    # There is a bug! If Survey is not fetched when we run this,
    # this throws an error.
    @item = Survey.find(params.id)
    @render()

  render: ->
    @html @view("surveys/show")(@item)

I keep getting errors from the commented part of the source: Uncaught Unknown record. Can I make the Survey.find() function block until Survey.fetch() is done?

  • 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-05-28T13:54:25+00:00Added an answer on May 28, 2026 at 1:54 pm

    You are correct in your diagnosis that you can’t find an item before you’ve fetched it from the server.

    The easiest solution is to bind an event to the Survey.fetch() call like so:

    Survey.bind 'refresh change', @method_to_call
    

    Let me know if that helps!

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

Sidebar

Related Questions

I'm trying to figure out how to use https://github.com/azicchetti/jquerymobile-router in my Spine project. I'm
Use case: user clicks the link on a webpage - boom! load of files
Use case: I've just entered insert mode, and typed some text. Now I want
use Rack::Static, :urls => ['/stylesheets', '/images'], :root => 'public' run proc { |env| [200,
Use case: class MyTask(Task): queue = 'default_queue' def run(self): # do work Normally I
We use PHP gearman workers to run various tasks in parallel. Everything works just
GUI i am trying to use JSpinner but as you can see from the
I'm working on a rails app and using spine, I want to use the
I want to use the Spine.js client-side framework, and it generates UUIDs as IDs
I would like to use the mobile library for spine in Rails 3.1.0. I

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.