2

i'm using Angular DataTables lib in my project. It allows to use datatables.net plugin in angular applications.

Is there some way to use datatables.net editor in angular component? My table has 2 boolean columns which can be edited and i can't find the way to inject editor in my component, so this code could work:

dtEditor :any={};
ngOnInit(): void {
//....
this.dtEditor = $.fn.dataTable.Editor( {
//Editor config
 });
}

And if it's no way to use editor, are there some other workaround to inline edit my data? Here is the code snippet of my editable fields and their render function:

//.... 
{
        title: 'No deposit',
        data: 'IsNoDeposit',
        render: this.renderCheckBoxData,
        className: "dt-body-center"
      }, {
        title: 'Is excluded',
        data: 'IsExcluded',
        render: this.renderCheckBoxData,
        className: "dt-body-center"
      }
//....
  private renderCheckBoxData ( data, type, row,meta ) {
    debugger;
    if ( type === 'display' ) {
      var chebx = '<input type="checkbox" class="editor-active"'+ (data?' checked ':'')+'>';

      return chebx;
    }
    return data;
  }
Mr. Henry
  • 37
  • 6

0 Answers0