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

How to load modal from table #13

Open
jackmatt2 opened this issue Jan 20, 2015 · 3 comments
Open

How to load modal from table #13

jackmatt2 opened this issue Jan 20, 2015 · 3 comments

Comments

@jackmatt2
Copy link

I have a table with a delete button on each row, basically when the user presses the delete button a model should show asking them to confirm. The model to delete is based on the row they select row. I can't seem to get this working with the modal component as these is no example of a actions being performed before opening the modal (I need to set the row as the deleteTarget on the controller). I can get it to a point where I cam able to open the modal for the selected record but there is no way of closing it. Is there any workaround for this?

 <button title="Delete" type="button" class="btn btn-danger btn-sm" {{action 'remove' row}}>
     <span class="glyphicon glyphicon-trash"></span>
   </button>

{{em-modal-confirm title="Delete Record" message="Are you sure you want to delete this record?" confirm-id=modelDeleteId configName="bs" close-if=noDeleteTargetDefined open-if=deleteTargetDefined }}
deleteTarget : null,
deleteTargetDefined : Ember.computed.bool('deleteTarget'),
noDeleteTargetDefined : Ember.computed.not('deleteTargetDefined'),
actions : {
        remove : function(model) {
            this.set('deleteTarget', model);
        }
}
@asaf
Copy link
Contributor

asaf commented Feb 12, 2015

@jackmatt2 have you managed?

Thanks

@jackmatt2
Copy link
Author

@asaf not yet.

@brianally
Copy link

I'm trying to figure out more or less the same thing. If I have a list of items using {{#each foo in model}} how to set foo so the template renders with foo's data? And why do we need to create a separate modal for each foo? This component doesn't appear to be very DRY.

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

No branches or pull requests

3 participants