我在我的机智的一端试图完成什么应该是非常简单的行为:我有一个Ember表格组件(从Addepar),我想在该表中的按钮,触发一个模态对话框。打开模式对话框从内部表格单元
由于我是新来的灰烬,我开始与现有的灰烬表入门套件jsbin这里:http://jsbin.com/fasudiki/9/edit
我添加了一个自定义单元格视图,所以我可以用我自己的模板:
columns: function() {
var firstColumn;
firstColumn = Ember.Table.ColumnDefinition.create({
columnWidth: 350,
textAlign: 'text-align-right',
headerCellName: 'Column 1',
tableCellViewClass: 'App.EmberTableMyCustomCell',
getCellContent: function(row) {
return row.get('myRandomValue').toFixed(2);
}
});
return [firstColumn];
}.property(),
与
App.EmberTableMyCustomCell = Ember.Table.TableCell.extend({
templateName: 'custom-table-cell',
classNames: 'custom-table-cell'
});
和
<script type="text/x-handlebars" data-template-name="custom-table-cell">
<span class="ember-table-content">
{{ view.cellContent}}
<button {{action 'openModal' 'modal'}}>This one doesn't</button>
<button {{action 'myCellAction' 'modal'}}>This one doesn't either</button>
</span>
</script>
我又试图按照官方灰烬指南模态对话框:http://emberjs.com/guides/cookbook/user_interface_and_interaction/using_modal_dialogs/
在灰烬的术语,我希望能够从余烬表组件内的触发指标航线上的动作。
我试图直接从没有工作模板触发动作:
<button {{action 'openModal' 'modal'}} >Open modal</button>
我又试图什么建议在“发送操作从元器件到你的应用程序”指南: http://emberjs.com/guides/components/sending-actions-from-components-to-your-application/
通过创建一个“动作”地图上的App.EmberTableMyCustomCell
视图,然后用这两种
this.send('openModal', 'modal');
和
this.sendAction('openModal', 'modal');
再次,没有成功。
我又试图什么在这太问题建议: Ember component sendAction() not working
在我烬表的自定义属性设置操作名称,并用它在使用triggerAction参数(...):
<div class="table-container">
{{table-component
hasFooter=false
columnsBinding="columns"
contentBinding="content"
myCustomActionName="openModal"
}}
</div>
和
actions : {
myCellAction : function() {
this.triggerAction('myCustomActionName', 'modal');
}
}
同样,没有成功。
任何想法我做错了什么?
我已经把代码jsbin:http://jsbin.com/yovikaviseve/2/edit