I have added a delete icon on the grid on Index.cshtml page. But i am not able to open the Delete modal on clicking the icon. help ? Here is my Delete controller :
(function () {
appModule.controller('tenant.views.records.deleteRecord', [
'$scope', '$uibModalInstance', 'abp.services.app.record',
function ($scope, $uibModalInstance, recordService) {
//----------delete record =====================
vm.deleteRecord = function (record) {
abp.message.confirm(
app.localize('AreYouSureToDeleteRecord', record.name),
function (isConfirmed) {
if (isConfirmed) {
recordService.deleteRecord({
id: record.id
}).success(function () {
abp.notify.success(app.localize('SuccessfullyDeleted'));
getRecords();
});
}
}
);
};
}
]);
})();
This is my ColumnDef attribute :
{
name: app.localize('Delete'),
field: '',
cellFilter: 'momentFormat: \'L\'',
cellTemplate: '<button '+
'ng-click="vm.deleteRecord(record)" '+
'title = "@L("Delete")"'+
'class="btn btn-circle btn-icon-only red delete-record"'+
' href ="javascript:;"><i class="icon-trash"></i></button>'
}
My RecordAppService :
public async Task DeleteRecord(IdInput<Guid> input) {
await _recordRepository.DeleteAsync(input.Id);//Check and confirm this
}
Nothing happens when i click the delete icon and there is no eror.
[attachment=1:2g9v0hmd]delete.png[/attachment:2g9v0hmd]
2 Answer(s)
-
0
Hi,
I think your ng-click in cell template should be like this,
ng-click="grid.appScope.deleteRecord(row.entity)"
-
0
yes !! Got it. Thank you so much.