Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/426.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 jQuery数据表宽度问题_Javascript_Jquery_Css_Datatables - Fatal编程技术网

Javascript jQuery数据表宽度问题

Javascript jQuery数据表宽度问题,javascript,jquery,css,datatables,Javascript,Jquery,Css,Datatables,我有一个使用javascript生成的表。该表有一个筛选器按钮,根据我的筛选器重新加载该表,然后,DataTable it: //here i declare the dataTable and clear it. Table = $('#pattern-style-a').dataTable(); Table.fnClearTable(); //here is a lot of functions that generates a html table with data contents.

我有一个使用javascript生成的表。该表有一个筛选器按钮,根据我的筛选器重新加载该表,然后,DataTable it:

//here i declare the dataTable and clear it.
Table = $('#pattern-style-a').dataTable();
Table.fnClearTable();

//here is a lot of functions that generates a html table with data contents.
<Javascript code that generates the html table with its data>

//here i transform my table into a dataTable(**the problem**)
$('#pattern-style-a').dataTable({
  "bDestroy": true,
  "sDom": '<"top">rt<"bottom"ip><"clear">',
  "bSort": true,
  "aaSorting": [[ 4, "asc" ]]
});
//这里我声明了dataTable并将其清除。
表=$('#pattern-style-a')。数据表();
Table.fnClearTable();
//这里有很多函数可以生成包含数据内容的html表。
//在这里,我将我的表转换为dataTable(**问题**)
$('#pattern-style-a')。数据表({
是的,
“sDom”:“rt”,
“bSort”:正确,
“aaSorting”:[[4,“asc”]]
});
我的问题是:当我将我的表转换为数据表时,它可以工作,但每次转换时整个表都会减少2倍

所以每次我执行这些代码时,我的表都会减少2px,它会无限地继续发生,我真的不知道为什么会发生这些-2px的事情


有人知道在清除表格并将其重新转换为datatable时这种奇怪的宽度减少吗?

脚本是否对其应用了静态像素维度?这个加上边框可以解释哪里的尺寸计算不正确。我的表中有边框,我不能有?