[英]JQuery Datatable set height on column after fnUpdate
I have a JQuery datatable, that I initializeby setting bAutoWidth to false. 我有一个JQuery数据表,通过将bAutoWidth设置为false进行初始化。 However after creating the table I need to loop over to edit one of the columns for each row to add a radio button.
但是,在创建表之后,我需要循环编辑每行的一列以添加单选按钮。 I do this through a for loop:
我通过一个for循环来做到这一点:
var rows = searchTable.fnGetNodes();
for(var row in rows) {
var rowText = oTable.fnGetData(rows[row],0);
var htmldata = $.parseHTML(rowText);
var myId = $(htmldata).attr("id");
var replaceHtml = '<input type="radio" id="' + myId +'" />';
oTable.fnUpdate(replaceHtml ,parseInt(row),0);
}
$("#my-table").css("width","100%");
fnUpdate destroys the widths I set in my datatable definition, which is why I reset the width after the loop, but the column width's are still incorrect. fnUpdate破坏了我在数据表定义中设置的宽度,这就是为什么我在循环后重新设置宽度,但列宽度仍然不正确的原因。 Is there a way I can reset the width per column after the loop?
有没有办法可以在循环后重置每列的宽度?
After looking around, I didn't really find an answer/function to setting the width on the column after a fnUpdate. 环顾四周后,在fnUpdate之后,我并没有真正找到设置列的宽度的答案/功能。
In my case I got around this by setting the column width in a css file for the div: 就我而言,我通过在div的css文件中设置列宽来解决此问题:
.radio-div{
input{width: 50px; display: inline-block;}
p{margin-top: 5px;}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.