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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T03:11:05+00:00 2026-06-18T03:11:05+00:00

On click of the ‘sort by age’, i am calling a function to fetch

  • 0

On click of the ‘sort by age’, i am calling a function to fetch data from server and sort by age value. i do this after i done the fetching, but it result nothing and return all..

any one give a correct way to implement this?

my code:

this code in the view class,

 sortByAge:function(){
        this.collection.fetch() //fetching new collection
        .done(function(data){ // once done i am passing data
            var filterType = data.sort('age') // correct way need to sort.
            that.collection.reset(filterType); // refreshing the collection
        })
    },
  • 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-18T03:11:06+00:00Added an answer on June 18, 2026 at 3:11 am

    If before doing a fetch you’re already aware that you need collection to be sorted by some specific column, from the docs, we can pass ajax options to the fetch. So fetch might look like this:

    this.collection.fetch({
      data: {
        sort_by: "age"
      }
    });
    

    sort_by parameter will be available in the server code being executed at the specified url for the collection, so you can return data from the server sorted by sort_by column. And then may be listen to reset event to do some work.

    And if you want to sort collection after getting it on the client side may be you can look at these similar questions.

    1. Sorting a Backbone Collection After initialization
    2. Proper way to sort a backbone.js collection on the fly
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

First click: empty floatymessage div. second click and after: works. jQuery: function floatymessage(message){ var
Click me $('.clickme').click(function(event) { event.preventDefault(); var stringId = $(this).attr(id); var mId = stringId.substring(2) ....
.bind('click',function(){ window.open($(this).find('.pc_more').html()); }); }); is there something in this part of the code that
click the button to call this method: private void goRegister(final boolean isUsername) { new
Click here to see what I mean.. What could prevent these two from sitting
Click on this link , you will be redirected to a shopping site. On
I click on a link from one page that does a redirect to another
Click event with jquery function is not working when it is before the a
After click the button Delete, How to display an alert if none of radio
click here for jsfiddle highchart link: Column - Bar High Chart this code is

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.