私は Angular と Smart-Table ( http://ngmodules.org/modules/Smart-Table ) を初めて使用し、テーブル行の削除機能を追加しようとしています。組み込み関数 (removeDataRow) がありますが、近くにある updateDataRow とは異なり、それをトリガーする方法を理解できませんでした。これまでの関連コードは次のとおりです。
deleteAction.html:
<button custom ng-click="doAction()"
class="btn btn-xs btn-primary">
Delete
</button>
表の列の定義:
$scope.columnCollectionDispo = [
{label: 'ID', map: 'dispositionId', isEditable: false},
{label: 'Name', map: 'name', isEditable: true},
{label: 'Code', map: 'code', isEditable: true},
{label: 'Description', map: 'description', isEditable: true},
{label: 'Sort Index', map: 'sortIndex', isEditable: true, type: 'number'},
{label: 'Status', map: 'status'},
{label:'actions', cellTemplateUrl:'../views/admin/deleteAction.html'}
];
表のグローバル構成:
$scope.globalConfig = {
isPaginationEnabled: true,
itemsByPage: 5,
maxSize: 10,
selectionMode: 'single',
doAction: function(){
$scope.$emit('deleteAction');
}
};
削除方法:
$scope.$on('deleteAction',function(){
alert("Delete List"); //just to see if I am reaching this code
});
テーブル表示:
<smart-table class="table table-striped" table-title="DispoElements"
config="globalConfig" rows=dispoElements columns="columnCollectionDispo">
</smart-table>
[削除] ボタンが表示され、removeDataRow メソッドをトリガーしようとするサイクル タイムが発生しました。それができないので、テーブル要素 ID を返して削除を実行する方法を見つけようとしています。むしろ組み込み関数を使用したいと思います。何か案は?ティア、テッド