indexiatech / ember-idx-modal

Ember Indexia Modal
http://indexiatech.github.io/ember-idx-modal/#/gettingstarted
Apache License 2.0
17 stars 13 forks source link

How to load modal from table #13

Open jackmatt2 opened 9 years ago

jackmatt2 commented 9 years ago

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 commented 9 years ago

@jackmatt2 have you managed?

Thanks

jackmatt2 commented 9 years ago

@asaf not yet.

brianally commented 9 years ago

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.