Insert checkbox beside filter(using sDom)

Insert checkbox beside filter(using sDom)

birger100birger100 Posts: 6Questions: 0Answers: 0
edited November 2011 in General
Hey
I'm trying to insert a checkbox beside the filter textbox.
I want the chk box to decide if a specified colom is displayed. I know this wil couse a postback to the server...
Is is possible to insert components using the sDom attribute so it will look soemthing like this "sDom": 'rtlfip',?
Or is there another way to show/hide coloums using a checkbox or somthing else.

By the way.. DataTables is simply awesome:)

Regards
Birger

Replies

  • fbasfbas Posts: 1,094Questions: 4Answers: 0
    edited November 2011
    No, but you can put a div id or classname in the div, then use javascript/jquery to add a checkbox to the div

    "sDom": 'rtl<"#checkbox">fip'

    (or "sDom": 'rtl<"#checkbox"f>ip' if you want the filter INSIDE the same div)

    [code]
    $('#checkbox').append(...); // or any other jquery/javascript operation
    [/code]

    http://www.datatables.net/ref#sDom
  • birger100birger100 Posts: 6Questions: 0Answers: 0
    Thanks for the reply.

    I would like to have a server control on there to toggle a colom on/off.
    But I see that not going to happen..

    Your solution works ok and I will find a solution from that.

    Again thanks for the support

    /Birger
  • fbasfbas Posts: 1,094Questions: 4Answers: 0
    you could still get server feedback. your script can set a javascript variable, and in your .append() code you can use the javascript variable to set the value of the checkbox.
This discussion has been closed.