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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T13:12:19+00:00 2026-06-11T13:12:19+00:00

I have a fairly large example but the issue is that when I transition

  • 0

I have a fairly large example but the issue is that when I transition to the pagination route the first time -all is good. But if I try to click on another (kicking off the pagination event) I get the error below

I don’t have a jsfiddle because this is using ember-data and the objects are databound to my REST endpoint.

The ember version is pre 1.0 using the latest ember-data + handlebars-1.0.0.beta.6 and jQuery 1.7.2

Uncaught Error: could not respond to event
paginateUsers in state root.paginated.

Here is my template and ember app

<script type="text/x-handlebars" data-template-name="person">

<table>
<thead></thead>
<tbody>
   {{#each person in controller.paginatedContent}}
    <tr>
      <td>{{person.id}}</td>
      <td>{{view Ember.TextField valueBinding="person.username"}}</td>
      <td><input type="submit" value="update" {{action updatePerson person}}/></td>
      <td><input type="submit" value="delete" {{action removePerson person}}/></td>
    </tr>
   {{/each}}
</tbody>
</table>
<ul class="pagination gui-text">
  <li name="prev"><span class="paginator" {{action prevPage href=true target="controller"}}>Prev>
  {{#each pages}}
    {{view PersonApp.PaginationItemView contentBinding="this"}}
  {{/each}}
  <li name="next"><span class="paginator" {{action nextPage href=true target="controller"}}>Next>
</ul></li>

</script>

<script type="text/x-handlebars" data-template-name="pagination_item">

{{#with view}}
<a {{action paginateUsers content href=true}}>
  <span {{bindAttr class="spanClasses isActive:active"}}>{{content.page_id}}</span>
</a>
{{/with}}

</script>


PersonApp = Ember.Application.create({});

PersonApp.ApplicationController = Ember.ObjectController.extend({});

PersonApp.ApplicationView = Ember.View.extend({
  templateName: 'application'
});

PersonApp.PersonView = Ember.View.extend({
  templateName: 'person',
  addPerson: function(event) {
    var username = event.context.username;
    if (username) {
      this.get('controller.target').send('addPerson', username);
      event.context.set('username', '');
    }
  }
});

PersonApp.Person = DS.Model.extend({
  id: DS.attr('number'),
  username: DS.attr('string')
});

PersonApp.Store = DS.Store.extend({
  revision: 4,
  adapter: DS.DjangoRESTAdapter.create({
    bulkCommit: false,
    plurals: {
      person: 'people'
    }
  })
});

PersonApp.PaginationItemView = Ember.View.extend({
  templateName: 'pagination_item',

  tagName: 'li',
  spanClasses: 'paginator pageNumber',

  isActive: function() {
    var currentPage = this.get('parentView.controller.currentPage');
    var page_id = this.get('content.page_id');

    if(currentPage) {
      return currentPage.toString() === page_id.toString();
    } else {
      return false;
    }
  }.property('parentView.controller.currentPage')
});

PersonApp.PersonController = Ember.ArrayController.extend({
  content: [],
  sortProperties: ['id'],
  pages: function() {
    var availablePages = this.get('availablePages'),
    pages = [],
    page;

    for (i = 0; i < availablePages; i++) {
      page = i + 1;
      pages.push({ page_id: page.toString() });
    }

    return pages;
  }.property('availablePages'),

  currentPage: function() {
    return this.get('selectedPage') || 1;
  }.property('selectedPage'),

  nextPage: function() {
    var availablePages = this.get('availablePages');
    var currentPage = parseInt(this.get('currentPage'), 10);
    var pages = this.get('pages');
    var nextPage;

    nextPage = currentPage + 1;

    if(nextPage > availablePages) {
      nextPage = nextPage - availablePages;
    }

    PersonApp.get('router').send('paginateUsers', pages[nextPage - 1]);
  },

  prevPage: function() {
    var availablePages = this.get('availablePages');
    var currentPage = parseInt(this.get('currentPage'), 10);
    var pages = this.get('pages');
    var nextPage;

    nextPage = currentPage - 1;

    if(nextPage <= 0) {
      nextPage = nextPage + availablePages;
    }

    PersonApp.get('router').send('paginateUsers', pages[nextPage - 1]);
  },

  availablePages: function() {
    var length = this.get('filteredContent.length');
    var itemsPerPage = 2;

    return (length / itemsPerPage) || 1;
  }.property('filteredContent.length'),

  paginatedContent: function() {
    var filteredContent = this.get('filteredContent');
    var selectedPage = this.get('selectedPage') || 1;

    var itemsPerPage = 2;
    var upperBound = (selectedPage * itemsPerPage);
    var lowerBound = (selectedPage * itemsPerPage) - itemsPerPage;

    return this.get('filteredContent').slice(lowerBound, upperBound);
  }.property('selectedPage', 'filteredContent.@each'),

  filteredContent: function() {
    return this.get('content');
  }.property('content.@each')
});

PersonApp.Router = Ember.Router.create({
  root: Ember.Route.extend({
    index: Ember.Route.extend({
      route: '/',
      paginateUsers: Ember.Route.transitionTo('paginated'),
      addPerson: function(router, username) {
        PersonApp.Person.createRecord({ username: username });
        router.get('store').commit();
      },
      updatePerson: function(router, event) {
        router.get('store').commit();
      },
      removePerson: function(router, event) {
        event.context.deleteRecord();
        router.get('store').commit();
      },
      connectOutlets: function(router) {
        router.get('applicationController').connectOutlet('person', router.get('store').findAll(PersonApp.Person));
      }
    }),

    paginated: Ember.Route.extend({
      route: '/page/:page_id',

      connectOutlets: function(router, context) {
        router.get('personController').set('selectedPage', context.page_id);
      },

      exit: function(router) {
        router.get('personController').set('selectedPage', undefined);
      }
    })
  })
});

$(function () {
  PersonApp.initialize(PersonApp.Router);
});
  • 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-11T13:12:20+00:00Added an answer on June 11, 2026 at 1:12 pm

    Your paginated route needs a paginateUsers action.

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

Sidebar

Related Questions

I have a fairly large webapp that I run on a Media Temple server.
I have a fairly large application that uses WPF for its user interface. I
I'm fairly new to Rational Functional Tester (Java) but I have one large blank.
I have a fairly large Indesign file with a text field that needs to
I have a fairly large CRUD WinForm app that has numerous objects. Person, Enrollment,
I'm building a fairly large plugin-driven app in my spare time, and have come
I have a circle image that's fairly large in size to make it easy
I have a UIScrollView that is scrolling a fairly large UIView. At certain times
I have a fairly large C++ application (on Windows, no other platforms planned), which
I have a fairly large Excel file. In this file there is a column

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.