Base solution for your next web application
Open Closed

Cannot open Delete Modal from Grid Cell #1671


User avatar
0
omkarchoudhari created

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]

Grid Shows up as :


2 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    I think your ng-click in cell template should be like this,

    ng-click="grid.appScope.deleteRecord(row.entity)"
    
  • User Avatar
    0
    omkarchoudhari created

    yes !! Got it. Thank you so much.