aoColumns dinamic

aoColumns dinamic

lukasnasclukasnasc Posts: 2Questions: 0Answers: 0
edited March 2010 in General
Hi,
How can I put one argument on "aoColumns" for the first column from my table? Example:
"aoColumns": [
{ "bVisible": false },
],
I have a dinamic table and when a put like this, give a error.

Thanks for now!!!

Replies

  • nglessngless Posts: 2Questions: 1Answers: 0
    You can do something like this:

    var cols = $('th').size();

    var i = 0;
    var arr = [
    { "bSortable": false },
    ];

    for (i = 1; i < cols; i = i + 1) {
    arr.push(null);
    }

    $('#results').dataTable({
    "aoColumns": arr
    });


    In the above example I grab the number of TH's my table has (i.e. columns) and build an array that I will set to my aoColumns parameter. Additionally in the example, I know that I always have at least 1 column and that the first column is not sortable.
  • leokormaleokorma Posts: 7Questions: 0Answers: 0
    Hi there! i had the same problem but i tried ngless solution and it works for me.
    Thank you very much.
  • lukasnasclukasnasc Posts: 2Questions: 0Answers: 0
    Thanks!!!
This discussion has been closed.