markcell / jquery-tabledit

Inline editor for HTML tables compatible with Bootstrap.
http://markcell.github.io/jquery-tabledit/
MIT License
435 stars 209 forks source link

duplicate edit and delete column tabledit datatable rowsgroup #147

Open pacifuentes opened 3 years ago

pacifuentes commented 3 years ago

Hi, Im using datatable, tabledit and rowsgroup based on this example (https://www.webslesson.info/2020/05/make-editable-datatable-using-jquery-tabledit-plugin-with-php-ajax.html), when i add propertie rowsgroup, datatable add or duplicate the edit and delete column of tabledit.

RowsGroup: <script src="https://cdn.rawgit.com/ashl1/datatables-rowsgroup/v1.0.0/dataTables.rowsGroup.js">

Duplicate2

the code of that, is this:

$(document).ready(function(){

 var dataTable = $('#sample_data').DataTable({
  "processing" : true,
  "serverSide" : true,
  "order" : [],
  columns: [
            {
                title: 'Id',
            },
            {
                name: 'first',
                title: 'Eje',
            },
            {
                name: 'second',
                title: 'Objetivo estrategico',
            },
            {
                title: 'Meta',
            },
            {
                title: 'Actividad',
            },
            {
                title: 'Meta esperada',
            },
        ],
  "ajax" : {
   url:"fetch.php",
   type:"POST"
  },
      rowsGroup: [ 'first:name','second:name' ],
 });

 $('#sample_data').on('draw.dt', function(){
  $('#sample_data').Tabledit({
   url:'action.php',
   dataType:'json',
   columns:{
    identifier : [0, 'id'],
    editable:[[4, 'actividad'], [5, 'meta']]
   },
   restoreButton:false,
   onSuccess:function(data, textStatus, jqXHR)
   {
    if(data.action == 'delete')
    {
     $('#' + data.id).remove();
     $('#sample_data').DataTable().ajax.reload();
    }
   }
  });
 });
}); 

Any idea?