admin管理员组文章数量:1399918
Any idea how to use columnDefs
property like below
var table = $('#myTable').DataTable( {
columnDefs: [
{ targets: [> 0], visible: true}
]
} );
Can I do that?
I need to target all columns except first column.
Any idea how to use columnDefs
property like below
var table = $('#myTable').DataTable( {
columnDefs: [
{ targets: [> 0], visible: true}
]
} );
Can I do that?
I need to target all columns except first column.
Share Improve this question edited Sep 21, 2016 at 9:27 Prakash Thete 3,89230 silver badges31 bronze badges asked Sep 21, 2016 at 8:07 WolfzmusWolfzmus 4671 gold badge12 silver badges24 bronze badges 5- Do you mean except the first column? E.g., you want it to apply to all of them other than the first? – T.J. Crowder Commented Sep 21, 2016 at 8:13
- Have you checked the documentation? It doesn't show any way to do that without using a class on all of the columns you want to target. – T.J. Crowder Commented Sep 21, 2016 at 8:13
- @T.J.Crowder Yes, thats i want it. – Wolfzmus Commented Sep 21, 2016 at 8:19
- @T.J.Crowder So wich mean i cant do that?? if i'm use specfication, i cant, cause my column always change. Wich mean i have filter date range, so my coulmn based on that date, if i'm pick Januray until May, so i have 4 column, Buyer, January, Ferbuary and May. tahts why i cant use target for spesifict – Wolfzmus Commented Sep 21, 2016 at 8:23
-
If you have 5 columns
targets: [1,2,3,4]
– davidkonrad Commented Sep 21, 2016 at 8:37
1 Answer
Reset to default 6Take a look on the documentation .
var table = $('#myTable').DataTable( {
columnDefs: [
{ targets: [0], visible: false},
{ targets: '_all', visible: true}
]
} );
The first column will be hidden in the table while all others will be visible.
本文标签: javascriptDatatables target except the first columnStack Overflow
版权声明:本文标题:javascript - Datatables target except the first column - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744167095a2593599.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论