简体   繁体   中英

hidden column issue with Datatables

I have rendered a hidden column using the fnRender function like this

"aTargets": [0],
"fnRender": function ( oObj ) {
return '<input id="test" name="test" value="'+ oObj.aData[0] +'" type="hidden" />';
}

and under aoColumns have defined null for it.

Now this field shows up as a column in the Datatables, which I do not want.

I tried the attribute bVisible:false , but that also removes it from rendering , hence I am unable to get the value from the hidden field.

Please help.

You need to hide the first column only :

"aoColumnDefs": [
    { "bVisible":    false, "aTargets": [0]}
]

Did a workaround , clubbed the value of the hidden field with a visible field with a expression "#" in between.

Performing a split on the String retrieved to get the value of the hidden field.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM