1

我正在尝试创建自定义操作但出了点问题,代码没有给我自定义操作按钮

我的设置,我在操作中添加了自定义按钮:

settings = {
actions: {
  edit: false,
  custom: [
    { 
      name: 'routeToAPage', 
      title: `<i class="ion-person" title="Xem thông tin người nhận Giftcode"></i>` 
    }
  ],
},
add: {
  addButtonContent: '<i class="ion-ios-plus-outline"></i>',
  createButtonContent: '<i class="ion-checkmark"></i>',
  cancelButtonContent: '<i class="ion-close"></i>',
  confirmCreate: true
},
columns: {
  stt: {
    title: 'STT',
    editable: false,
  },
},
pager : {
    display : true,
    perPage: 10
}
};

我的 HTML 代码:

      <ba-card class="smart-table-container">
          <ng2-smart-table 
          [settings]="settings" 
          [source]="source" 
          (deleteConfirm)="onDeleteConfirm($event)"
          (custom)="onCustom($event)"
          ></ng2-smart-table>
      </ba-card>

我的问题是什么?

谢谢!

4

1 回答 1

2

我试过这个。请浏览我的代码源:LocalDataSource;

  settings = {
   columns: {
  Status: {
    title: 'Status'
    , class: 'align-centerr'
  },
  FullName: {
    title: 'Full Name'
  },
  JobTitle: {
    title: 'Job Title'
  },
  Department: {
    title: 'Department'
  },
  EmailAddress: {
    title: 'Email Address'
  },
  MobilePhone: {
    title: 'Mobile No'
  },


},
actions: {
  edit: false,
  custom: [{ name: 'Edit', title: `<i  class="fa fa-edit"></i>` },
    { name: 'Activate', title: `<i class="fa fa-toggle-on"></i>` },
    { name: 'Deactivate', title: `<i  class="fa fa-toggle-off"></i>` }
  ],

},


delete: {
  deleteButtonContent: '',
  confirmDelete: true
},
add: null,
defaultStyle: false
  ,
    rowClassFunction: (row) => {
    if (row.data.Status === 'Inactive')
   {
         return 'success-table';
   } else if (row.data.Status === 'Active') {
    return 'warning-table';

  }
}
于 2017-11-15T06:35:12.500 回答