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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T02:18:46+00:00 2026-06-14T02:18:46+00:00

I have a ArrayController for date picker with properties to and from . Now

  • 0

I have a ArrayController for date picker with properties to and from. Now when user selects a new date range from the UI both to and from value changes.

So a function which observers on to and from is trigger twice for a single change in date range.

I want to trigger the function only one every date range change. Any suggestions how to do that with ember

    app = Ember.Application.create();

    app.Time = Ember.ArrayController.create({

        to: null,
        from: null,
        rootElement: "#time",

        debug1: function() {
            this.set('to', 1);
            this.set('from', 2);
        },

        debug2: function() {
            this.setProperties( {
                'to': 3,
                'from': 4
            });
        },

        debug3: function() {
            this.beginPropertyChanges();
            this.set('to', 5);
            this.set('from', 6);
            this.endPropertyChanges();
        },

        search: function() {
            alert('called');
        }.observes('to', 'from')
    });

View in JS Fiddle

  • 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-14T02:18:48+00:00Added an answer on June 14, 2026 at 2:18 am

    Perhaps you can introduce a computed property on from and to, and then plug the observer on this property. As CPs are cached by default, I think the observer will be triggered only once.

    date: function(){
     // return the computed date
    }.property('from', 'to')
    
    dateDidChange: function(){
    
    }.observes('date')
    

    EDIT Thanks to your fiddle, it seems to work using setProperties, or begin/end propertyChanges http://jsfiddle.net/Sly7/zf2q3/1/

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

Sidebar

Related Questions

Both ArrayController and CollectionView have same functionality to render 'content' array using template, except
I have a controller object that's like: MyApp.objController = Ember.ArrayController.create({ init: function(data) { data.isValid
I have a list of object, stored in an arrayController and rendered on the
I have a Form element: $Form=new Zend_Form; $Form->setAction($this->view->url(array('controller'=>'auth','action'=>'create'),null,true)) ->setMethod('post') ->setAttrib('id','auth-form') ->removeAttrib('enctype'); As can be
I have a texfield bound to an ArrayController. The controller key is selection because
I have an NSTableview which s bound to a NSArrayController. The Table/Arraycontroller contains Core
I have an NSTableView, the content of which is bound to an arrayController using
I have an Ember.js app as follows (borrowed from this article on andyMatthews.net): View:
I have an Ember application with both a view and a controller: http://jsfiddle.net/gavriguy/EDr4G/ I
I have the following ember.js code: app.js: Game = Ember.Application.create({ ready: function() { Game.gameController.getChallenge();

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.