Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/70.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 隐藏div导出数据表_Javascript_Jquery_Datatables - Fatal编程技术网

Javascript 隐藏div导出数据表

Javascript 隐藏div导出数据表,javascript,jquery,datatables,Javascript,Jquery,Datatables,我正试图导出一个数据表,但其中有一个工具提示。这是一个数据表,其中包含进度条和工具提示: 问题是,当我将表格导出到Excel时,它具有工具提示信息。这样地: 例如,我只想让它显示100%。这里是我的php代码 <td> <div class="progress"> <div class='<?=barra($institucional); ?>' role="progressbar" style="width:<?=$institu

我正试图导出一个数据表,但其中有一个工具提示。这是一个数据表,其中包含进度条和工具提示:

问题是,当我将表格导出到Excel时,它具有工具提示信息。这样地:

例如,我只想让它显示100%。这里是我的php代码

<td>
  <div class="progress">
    <div class='<?=barra($institucional); ?>' role="progressbar" style="width:<?=$institucional;?>%">
      <?=$institucional;?>%
    </div>
    <div class="info" style="display: none;">
      <strong>Acción:</strong> <?=round($row['accion']/3,2);?>%<br>
      <strong>Eje:</strong> <?=round($row['eje']/3,2);?>%<br>
      <strong>Programa:</strong> <?=round($row['programa']/3,2);?>%<br>
    </div> 
  </div>
因此,我所有的进度条都有一个信息隐藏div,其中包含工具提示的数据。但我不想导出工具提示数据


有什么想法吗?

我认为您应该尝试使用,下面是代码示例:

var buttonCommon = { exportOptions: {
                       format: {
                       body: function (data, row, column, node) {
                       // here you must get which column you want to change the data, it using number not column name, column number start from 0
                       return column === 5 ? 'your desired value' : data;
                    }
                }
            }
        };

$('#example').DataTable({
    ajax: "ajax_data.txt",
    columns: [
      { data: 'name' },
      { data: 'position' },
      { data: 'office' },
      { data: 'extn' },
      { data: 'start_date' },
      { data: 'salary' }
   ],
   dom: 'Bfrtip',
   buttons: [
      $.extend(true, {}, buttonCommon, {
        extend: 'csv'
      })
   ]
});
因此,当您单击“导出”按钮时,它将根据所需数据修改数据输出

var buttonCommon = { exportOptions: {
                       format: {
                       body: function (data, row, column, node) {
                       // here you must get which column you want to change the data, it using number not column name, column number start from 0
                       return column === 5 ? 'your desired value' : data;
                    }
                }
            }
        };

$('#example').DataTable({
    ajax: "ajax_data.txt",
    columns: [
      { data: 'name' },
      { data: 'position' },
      { data: 'office' },
      { data: 'extn' },
      { data: 'start_date' },
      { data: 'salary' }
   ],
   dom: 'Bfrtip',
   buttons: [
      $.extend(true, {}, buttonCommon, {
        extend: 'csv'
      })
   ]
});