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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T07:40:51+00:00 2026-06-04T07:40:51+00:00

I want to be able to sort the data after adding a model to

  • 0

I want to be able to sort the data after adding a model to the collection. If I don’t apply silent:true the collection will be render but everything doubles up. Is there another way?

I’m rendering the template on initialize function and rendering the collection sub view after reset.

  • 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-04T07:40:52+00:00Added an answer on June 4, 2026 at 7:40 am

    Got it to work though I’ll answer my question because i’m not sure if this is the best answer so comments are welcome.

    on my view:

        initialize : function(){
            this.$el.html( this._template );
            this.collection.bind('reset', this.LoadItems, this);
            this.collection.bind('add', this.AddOneItem, this);
            $("#settings-category").trigger("create");  
        },
    
        LoadItems : function(){
            this.collection.each(function(model){
                this.view = new CurrentCategoryView({model : model});
                 $("#currentCategoryListContainer").append(this.view.render().el);
            });
            $("#currentCategoryListContainer").listview("refresh");
        },
    

    this results to a normal rendering of DOM elements but if i use sort which eventually triggers a reset my function doesn’t include the code above so the result is that it doesn’t clear up the DOM elements and proceed on adding more elements causing the Collection models to be rendered twice. So here is my solution.

    $("#currentCategoryListContainer").empty();
    this.collection.sort();
    

    In this way i clears up the already occupied DOM to make way for the new Items( sorted items) to be rendered.

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

Sidebar

Related Questions

I want to be able to sort files based on what day they were
I have main categories and sub categories. I want to be able to sort
Want to be able to provide a search interface for a collection of objects
I want to be able to invoke an SSIS package at will from a
I need to be able to parse this sort of data in PHP: Acct:
I'm trying to store randomly generated dice values in some data structure, but don't
I've already created my XSLT but id like to be able to sort the
We're using DevExpress Xtra reports, but they don't seem to be able to meet
I want to be able to sort elements based on an attribute in my
I'm using LaTeX and BibTeX for an article, and I want to able to

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.