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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T06:22:33+00:00 2026-06-17T06:22:33+00:00

I have a list of clients displayed through a ClientsController, its content is set

  • 0

I have a list of clients displayed through a ClientsController, its content is set to the Client.find() i.e. a RecordArray. User creates a new client through a ClientController whose content is set to Client.createRecord() in the route handler.

All works fine, however, while the user fills up the client’s creation form, the clients list gets updated with the new client record, the one created in the route handler.

What’s the best way to make RecordArray/Store only aware of the new record until the record is saved ?

UPDATE:
I ended up filtering the list based on the object status

{{#unless item.isNew}} Display the list {{/unless}}

UPDATE – 2
Here’s an alternative way using filter, however the store has to be loaded first through the find method, App.Client.find().filter() doesn’t seem to behave the way the two methods behave when called separately.

// Load the store first     
App.Client.find();
    var clients = App.Client.filter(function(client){            
        console.info(client.get('name') + ' ' + client.get('isNew'));  
        return !client.get('isNew');
    });                   
    controller.set('content',clients);  
  • 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-17T06:22:35+00:00Added an answer on June 17, 2026 at 6:22 am

    Few ways to go about this:

    First, it’s very messy for a route/state that deals with a list of clients to have to go out of its way to filter out junk left over from another unrelated state (i.e. the newClient state). I think it’d be way better for you to delete the junk record before leaving the newClient state, a la

    if(client.get("isNew")) {
      client.deleteRecord();
    }
    

    This will make sure it doesn’t creep into the clientIndex route, or any other client list route that shouldn’t have to put in extra work to filter out junk records. This code would ideally sit in the exit function of your newClient route so it can delete the record before the router transitions to another state that’ll called Client.find()

    But there’s an even better, idiomatic solution: https://gist.github.com/4512271

    (not sure which version of the router you’re using but this is applicable to both)

    The solution is to use transactions: instead of calling createRecord() directly on Client, call createRecord() on the transaction, so that the new client record is associated with that transaction, and then all you need to do is call transaction.rollback() in exit — you don’t even need to call isNew on anything, if the client record was saved, it obviously won’t be rolled back.

    This is also a useful pattern for editing records: 1) create a transaction on enter state and add the record to it, e.g.

    enter: function(router, client) {
         this.tx = router.get("store").transaction();
         this.tx.add(client); 
    },
    

    then the same sort of thing on the exit state:

    exit: function(router, client) {
         this.tx.rollback();
    },
    

    This way, if the user completes the form and submits to the server, rollback will correctly/conveniently do nothing. And if the user edits some of the form fields but then backs out halfway through, your exit callback will revert the unsaved changes, so that you don’t end up with some dirty zombie client popping up in your clientIndex routes display it’s unsaved changes.

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

Sidebar

Related Questions

I have a page in Sitecore that displays the list of clients. There's a
I have a list of checkboxes like you would see in most email clients
I have a view called, clients which shows a list of calls from the
I have a web application that allows users to build a 'client list.' We
i have list of rows that user select and i want to delete them,
I've got a list of clients who have certain tasks done on a weekly
I have a class Client, a Class Assignment and a static class Clients which
I have a drop down list and it has values through 2 to 12.
I have a list of items displayed in the UI. They are in the
I have a php script which queries a list of clients from a mysql

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.