sDom and using ColVis

sDom and using ColVis

markjomarkjo Posts: 66Questions: 0Answers: 0
edited May 2013 in General
In my current datatables I use this:
[code]"sDom":'<"top"iflp<"clear">>rt<"bottom"iflp<"clear">>',[/code]

But I need to add button for ColVis plugin.
It seems like I need to change sDom like this:
[code]"sDom": 'C<"clear">lfrtip'[/code]

How can I combine my current sDom and ColVis sDom?
Thank you

Replies

  • allanallan Posts: 63,516Questions: 1Answers: 10,472 Site admin
    Just put a `C` at the front (or wherever your what the ColVis component to appear). Each letter is a control in sDom - `C` is ColVis' letter.

    Allan
  • markjomarkjo Posts: 66Questions: 0Answers: 0
    My datatables code is like the below.

    [code]pagination = "full_numbers";
    aoColumnDefs = [
    { "sType":"title-numeric", "aTargets":[ 3 ] },
    { "sType":"title-numeric", "aTargets":[ 7 ] },
    { "bSortable":false, "aTargets":[ 0 ] },
    { "bSortable":false, "aTargets":[ 8 ] },
    { "bSortable":false, "aTargets":[ 9 ] },
    { "sClass":"center", "aTargets":[ 2, 3, 4, 5, 6, 7 ] }
    ];
    defaultSort = [[ 7, "desc" ]];

    $('#myTable').dataTable(
    {
    "aoColumnDefs":aoColumnDefs,
    "sPaginationType": pagination,
    "aaSorting": defaultSort,
    "bPaginate":true,
    "sDom":'<"top"iflp<"clear">>rt<"bottom"iflp<"clear">>',
    "fnDrawCallback": function () { updateTableFuncts() },
    "iDisplayLength":25,
    "aLengthMenu": [[10, 25, 50], [10, 25, 50]],
    }
    );[/code]


    Changing sDom from
    [code]"sDom":'<"top"iflp<"clear">>rt<"bottom"iflp<"clear">>',[/code]
    to
    [code]"sDom":'C<"top"iflp<"clear">>rt<"bottom"iflp<"clear">>',[/code]
    didn't change anything.

    Does something conflicts and block ColVis button ?
    Thank you.
  • allanallan Posts: 63,516Questions: 1Answers: 10,472 Site admin
    Please link to a test case showing the issue: http://datatables.net/forums/discussion/12899/post-test-cases-when-asking-for-help-please-read . It looks like it should be working.

    Allan
  • markjomarkjo Posts: 66Questions: 0Answers: 0
    Here I posted an example:
    http://live.datatables.net/azucem/9/

    I changed sDom to see ColVis, but didn't appear.
  • allanallan Posts: 63,516Questions: 1Answers: 10,472 Site admin
    Thank your or the link. I don't actually see ColVis's script being loaded? Am I missing something?

    Allan
  • markjomarkjo Posts: 66Questions: 0Answers: 0
    Oh my bad. I should have include js and css files of ColVis.
    I understand that after your last comment :)
    http://datatables.net/releases/ColVis-1.0.8.zip
  • markjomarkjo Posts: 66Questions: 0Answers: 0
    I added ColVis.js and ColVis's default.css and updated the demo:
    http://live.datatables.net/azucem/14

    I can see "Show/Hide columns" button but clicking the button and checking out column names doesn't affect on columns. Should I make anything more?
  • markjomarkjo Posts: 66Questions: 0Answers: 0
    Do I miss something while using ColVis?
  • allanallan Posts: 63,516Questions: 1Answers: 10,472 Site admin
    Its not immediately obvious why that isn't working. I'll try to take a look in more detail when I have a little more time available.

    Allan
This discussion has been closed.