Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rendering hierarchy out of place, toggleProperty toggles all items in array when called on itemController. #5330

Closed
philn5d opened this issue Aug 6, 2014 · 6 comments

Comments

@philn5d
Copy link

philn5d commented Aug 6, 2014

2 issues:

  1. Updated to latest, now the plus (toggleProperty action) causes each item in the array to toggle.
  2. Nested components/views rendering out of place when clicking from ma1 to ma2 (or similar). Reloading the page causes proper rendering.

http://jsbin.com/wijigo/1/edit

@philn5d
Copy link
Author

philn5d commented Aug 6, 2014

Turns out that the action 'toggleProperty' is being called on the ClientsController since it's in the clients template. If I could delegate that to the appropriate itemController that would resolve that issue.

@philn5d
Copy link
Author

philn5d commented Aug 7, 2014

resolved my own issue 1 by defining the itemController in the view and using client.isExpanded:

{{#each client in controller itemController="client"}}
<li >
    <span {{action 'toggleProperty' 'isExpanded'}} style="cursor:pointer;">[{{#if client.isExpanded}}-{{else}}+{{/if}}]
        {{#link-to "client" client}}{{client.name}}{{/link-to}}
    </span>
    {{#if client.isExpanded}}
        {{left-nav links=client.matters routeName="matter"}}
    {{/if}}
</li>
{{/each}}

@stefanpenner
Copy link
Member

calling methods via actions is actually deprecate. Please define the action on your controller, and then your controller action can invoke toggleProperties appropriately

@philn5d
Copy link
Author

philn5d commented Aug 7, 2014

Done thanks. I'm still invoking the action via action and calling toggleProperty action on the itemController, which I had to define in the action helper in order for it to expand only the client that was clicked on. The bigger issue is that when you run the bin, click "clients", click client "man", click "ma1" (output renders as expected), then click "ma2" (the hierarchy is jumbled for the teams).

http://jsbin.com/wijigo/1/edit

@wagenet
Copy link
Member

wagenet commented Nov 1, 2014

@stefanpenner can you verify if this is a bug?

@stefanpenner
Copy link
Member

itemController and arrayControllers are deprecated

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants