findAll with a property defined by parentReturning a Promise from a Computed Propertycomputed property based on children within a collection of parentsHow to update child records in the store when parent record is saved?Is it possible to bind a parent component’s property, via template, to a child component computed property?Ember computed dynamic property pathEmber - child component updating a property coming from query params via parent componentCan an Ember component inherit parent component properties without passing in the template?Ember 2.11, Data passed between parent to child components.Angular 4 How to update parent component after delete an item in child componentEmber data changes in parent component not refelecting on UIangular sub components update a list in the parent component

Alternative to sending password over mail?

Western buddy movie with a supernatural twist where a woman turns into an eagle at the end

What's the point of deactivating Num Lock on login screens?

Emailing HOD to enhance faculty application

Intersection of two sorted vectors in C++

How do I write bicross product symbols in latex?

If human space travel is limited by the G force vulnerability, is there a way to counter G forces?

Has there ever been an airliner design involving reducing generator load by installing solar panels?

What is going on with Captain Marvel's blood colour?

How can saying a song's name be a copyright violation?

Why doesn't H₄O²⁺ exist?

Is it possible to create light that imparts a greater proportion of its energy as momentum rather than heat?

I'm flying to France today and my passport expires in less than 2 months

Forgetting the musical notes while performing in concert

Is there a hemisphere-neutral way of specifying a season?

Could gravitational lensing be used to protect a spaceship from a laser?

Can a rocket refuel on Mars from water?

Can a virus destroy the BIOS of a modern computer?

What does it mean to describe someone as a butt steak?

Doing something right before you need it - expression for this?

Would Slavery Reparations be considered Bills of Attainder and hence Illegal?

Infinite Abelian subgroup of infinite non Abelian group example

Can I ask the recruiters in my resume to put the reason why I am rejected?

What reasons are there for a Capitalist to oppose a 100% inheritance tax?



findAll with a property defined by parent


Returning a Promise from a Computed Propertycomputed property based on children within a collection of parentsHow to update child records in the store when parent record is saved?Is it possible to bind a parent component’s property, via template, to a child component computed property?Ember computed dynamic property pathEmber - child component updating a property coming from query params via parent componentCan an Ember component inherit parent component properties without passing in the template?Ember 2.11, Data passed between parent to child components.Angular 4 How to update parent component after delete an item in child componentEmber data changes in parent component not refelecting on UIangular sub components update a list in the parent component






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








1















2 components, 1 parent 1 child. The parent is a list with buttons. User clicks the button and the child editor becomes visible and the variable listType gets passed to the child from the parent.



I want a property to do a findAll in the child based on the listType property, e.g.



listType:null,
records: this.get('store').findAll(this.get('listType'));


problem is when the child editor first inits listType is undefined and takes a moment for the data to be passed down from the parent. How should I compute the records based on the listType so that it can dynamically change records when a different listType is selected from the parent list and not crash when the listType property is undefined on init?



This might seem a little weird but I have 20 different listTypes and being able to compute records this way will save me from having to create an additional 40 files to save and delete the model types required.










share|improve this question






























    1















    2 components, 1 parent 1 child. The parent is a list with buttons. User clicks the button and the child editor becomes visible and the variable listType gets passed to the child from the parent.



    I want a property to do a findAll in the child based on the listType property, e.g.



    listType:null,
    records: this.get('store').findAll(this.get('listType'));


    problem is when the child editor first inits listType is undefined and takes a moment for the data to be passed down from the parent. How should I compute the records based on the listType so that it can dynamically change records when a different listType is selected from the parent list and not crash when the listType property is undefined on init?



    This might seem a little weird but I have 20 different listTypes and being able to compute records this way will save me from having to create an additional 40 files to save and delete the model types required.










    share|improve this question


























      1












      1








      1








      2 components, 1 parent 1 child. The parent is a list with buttons. User clicks the button and the child editor becomes visible and the variable listType gets passed to the child from the parent.



      I want a property to do a findAll in the child based on the listType property, e.g.



      listType:null,
      records: this.get('store').findAll(this.get('listType'));


      problem is when the child editor first inits listType is undefined and takes a moment for the data to be passed down from the parent. How should I compute the records based on the listType so that it can dynamically change records when a different listType is selected from the parent list and not crash when the listType property is undefined on init?



      This might seem a little weird but I have 20 different listTypes and being able to compute records this way will save me from having to create an additional 40 files to save and delete the model types required.










      share|improve this question
















      2 components, 1 parent 1 child. The parent is a list with buttons. User clicks the button and the child editor becomes visible and the variable listType gets passed to the child from the parent.



      I want a property to do a findAll in the child based on the listType property, e.g.



      listType:null,
      records: this.get('store').findAll(this.get('listType'));


      problem is when the child editor first inits listType is undefined and takes a moment for the data to be passed down from the parent. How should I compute the records based on the listType so that it can dynamically change records when a different listType is selected from the parent list and not crash when the listType property is undefined on init?



      This might seem a little weird but I have 20 different listTypes and being able to compute records this way will save me from having to create an additional 40 files to save and delete the model types required.







      ember.js dynamic parent record findall






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Mar 8 at 23:55







      Mike R

















      asked Mar 8 at 23:49









      Mike RMike R

      84




      84






















          1 Answer
          1






          active

          oldest

          votes


















          1














          It looks like you need a computed property in your child component which is able to react to a missing listType.



          import Component from '@ember/component';
          import computed from '@ember/object';
          import inject as service from '@ember/service';

          export default Component.extend(
          store: service(),
          listType: null,
          records: computed('listType', function ()
          if (!this.listType)
          return null;


          return this.store.findAll(this.listType);
          ),
          );


          records is going to return a promise and you will have to handle it this way in your template. I personally use this method https://stackoverflow.com/a/40180704/796999.



          Another option could be passing records into the child component instead of looking them up there. You would create the computer property the same way and just change your parent template to have
          child-component records=records.






          share|improve this answer

























          • Ok got the computed property to work. Issue now is the child component hbs does not recompute and display data in the DOM. does not iterate in the child

            – Mike R
            Mar 11 at 15:34












          • I just added some information on rendering a promise, let me know if that helps.

            – jrjohnson
            Mar 11 at 16:04











          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55072556%2ffindall-with-a-property-defined-by-parent%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          1














          It looks like you need a computed property in your child component which is able to react to a missing listType.



          import Component from '@ember/component';
          import computed from '@ember/object';
          import inject as service from '@ember/service';

          export default Component.extend(
          store: service(),
          listType: null,
          records: computed('listType', function ()
          if (!this.listType)
          return null;


          return this.store.findAll(this.listType);
          ),
          );


          records is going to return a promise and you will have to handle it this way in your template. I personally use this method https://stackoverflow.com/a/40180704/796999.



          Another option could be passing records into the child component instead of looking them up there. You would create the computer property the same way and just change your parent template to have
          child-component records=records.






          share|improve this answer

























          • Ok got the computed property to work. Issue now is the child component hbs does not recompute and display data in the DOM. does not iterate in the child

            – Mike R
            Mar 11 at 15:34












          • I just added some information on rendering a promise, let me know if that helps.

            – jrjohnson
            Mar 11 at 16:04















          1














          It looks like you need a computed property in your child component which is able to react to a missing listType.



          import Component from '@ember/component';
          import computed from '@ember/object';
          import inject as service from '@ember/service';

          export default Component.extend(
          store: service(),
          listType: null,
          records: computed('listType', function ()
          if (!this.listType)
          return null;


          return this.store.findAll(this.listType);
          ),
          );


          records is going to return a promise and you will have to handle it this way in your template. I personally use this method https://stackoverflow.com/a/40180704/796999.



          Another option could be passing records into the child component instead of looking them up there. You would create the computer property the same way and just change your parent template to have
          child-component records=records.






          share|improve this answer

























          • Ok got the computed property to work. Issue now is the child component hbs does not recompute and display data in the DOM. does not iterate in the child

            – Mike R
            Mar 11 at 15:34












          • I just added some information on rendering a promise, let me know if that helps.

            – jrjohnson
            Mar 11 at 16:04













          1












          1








          1







          It looks like you need a computed property in your child component which is able to react to a missing listType.



          import Component from '@ember/component';
          import computed from '@ember/object';
          import inject as service from '@ember/service';

          export default Component.extend(
          store: service(),
          listType: null,
          records: computed('listType', function ()
          if (!this.listType)
          return null;


          return this.store.findAll(this.listType);
          ),
          );


          records is going to return a promise and you will have to handle it this way in your template. I personally use this method https://stackoverflow.com/a/40180704/796999.



          Another option could be passing records into the child component instead of looking them up there. You would create the computer property the same way and just change your parent template to have
          child-component records=records.






          share|improve this answer















          It looks like you need a computed property in your child component which is able to react to a missing listType.



          import Component from '@ember/component';
          import computed from '@ember/object';
          import inject as service from '@ember/service';

          export default Component.extend(
          store: service(),
          listType: null,
          records: computed('listType', function ()
          if (!this.listType)
          return null;


          return this.store.findAll(this.listType);
          ),
          );


          records is going to return a promise and you will have to handle it this way in your template. I personally use this method https://stackoverflow.com/a/40180704/796999.



          Another option could be passing records into the child component instead of looking them up there. You would create the computer property the same way and just change your parent template to have
          child-component records=records.







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Mar 11 at 16:03

























          answered Mar 9 at 16:46









          jrjohnsonjrjohnson

          895818




          895818












          • Ok got the computed property to work. Issue now is the child component hbs does not recompute and display data in the DOM. does not iterate in the child

            – Mike R
            Mar 11 at 15:34












          • I just added some information on rendering a promise, let me know if that helps.

            – jrjohnson
            Mar 11 at 16:04

















          • Ok got the computed property to work. Issue now is the child component hbs does not recompute and display data in the DOM. does not iterate in the child

            – Mike R
            Mar 11 at 15:34












          • I just added some information on rendering a promise, let me know if that helps.

            – jrjohnson
            Mar 11 at 16:04
















          Ok got the computed property to work. Issue now is the child component hbs does not recompute and display data in the DOM. does not iterate in the child

          – Mike R
          Mar 11 at 15:34






          Ok got the computed property to work. Issue now is the child component hbs does not recompute and display data in the DOM. does not iterate in the child

          – Mike R
          Mar 11 at 15:34














          I just added some information on rendering a promise, let me know if that helps.

          – jrjohnson
          Mar 11 at 16:04





          I just added some information on rendering a promise, let me know if that helps.

          – jrjohnson
          Mar 11 at 16:04



















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55072556%2ffindall-with-a-property-defined-by-parent%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Can't initialize raids on a new ASUS Prime B360M-A motherboard2019 Community Moderator ElectionSimilar to RAID config yet more like mirroring solution?Can't get motherboard serial numberWhy does the BIOS entry point start with a WBINVD instruction?UEFI performance Asus Maximus V Extreme

          Identity Server 4 is not redirecting to Angular app after login2019 Community Moderator ElectionIdentity Server 4 and dockerIdentityserver implicit flow unauthorized_clientIdentityServer Hybrid Flow - Access Token is null after user successful loginIdentity Server to MVC client : Page Redirect After loginLogin with Steam OpenId(oidc-client-js)Identity Server 4+.NET Core 2.0 + IdentityIdentityServer4 post-login redirect not working in Edge browserCall to IdentityServer4 generates System.NullReferenceException: Object reference not set to an instance of an objectIdentityServer4 without HTTPS not workingHow to get Authorization code from identity server without login form

          2005 Ahvaz unrest Contents Background Causes Casualties Aftermath See also References Navigation menue"At Least 10 Are Killed by Bombs in Iran""Iran"Archived"Arab-Iranians in Iran to make April 15 'Day of Fury'"State of Mind, State of Order: Reactions to Ethnic Unrest in the Islamic Republic of Iran.10.1111/j.1754-9469.2008.00028.x"Iran hangs Arab separatists"Iran Overview from ArchivedConstitution of the Islamic Republic of Iran"Tehran puzzled by forged 'riots' letter""Iran and its minorities: Down in the second class""Iran: Handling Of Ahvaz Unrest Could End With Televised Confessions""Bombings Rock Iran Ahead of Election""Five die in Iran ethnic clashes""Iran: Need for restraint as anniversary of unrest in Khuzestan approaches"Archived"Iranian Sunni protesters killed in clashes with security forces"Archived