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

          Thal And Out Agency railway station See also References External links Navigation menuOfficial Web Site of Pakistan RailwaysArchivedOfficial Web Site of Pakistan Railwayseeexpanding ite

          Understanding generators in Python2019 Community Moderator ElectionGenerator function not working pythonFor loop not executing two timesGenerators - Printing generated valuesWhy can a python generator only be used once?What exactly do generators do?What does the “yield” keyword do?What does “list comprehension” mean? How does it work and how can I use it?sklearn Kfold acces single fold instead of for loopIs a generator the callable? Which is the generator?Apply Border To Range Of Cells Using OpenpyxlCalling an external command in PythonWhat are metaclasses in Python?What is the difference between @staticmethod and @classmethod?Finding the index of an item given a list containing it in PythonDifference between append vs. extend list methods in PythonHow can I safely create a nested directory in Python?Does Python have a ternary conditional operator?Understanding slice notationUnderstanding Python super() with __init__() methodsDoes Python have a string 'contains' substring method?

          How can I change the color of pagination dots of UIPageControl?How to change UIPageControl dotsIs there a way to change page indicator dots colorCustomize dot with image of UIPageControl at index 0 of UIPageControlNo visible @interface for 'NSObject<PageControlDelegate>' declares the selector 'pageControlPageDidChange:'How to change the color of pagination dots in UIPageControl with a different color per pagepagecontrol indicator custom image instead of DefaultChanging the colour of UIPageControl dots in MonoTouchpagecontrol selectable page visibility color?Alternative way to load ViewControllers on a UIPageControlHow to set only layer.border-color for UIpage control dots in swiftHow can I develop for iPhone using a Windows development machine?How to change the name of an iOS app?UITableView - change section header coloruipagecontrol indicator(dot)issueCustom UIPageControl dots color not changingchange the interspace between UIPageControl dotsHow to change Status Bar text color in iOSHow can I change image tintColor in iOS and WatchKitUIPageControl dots with larger space in between each dotsHow to change the color of pagination dots in UIPageControl with a different color per page