a.aoColumns[c] is undefined

a.aoColumns[c] is undefined

bidon2bidon2 Posts: 20Questions: 2Answers: 0
edited January 2013 in General
Hi, i'm setting up DataTables for the first time.
I included it in the bottom of my page using:
[code]


$(document).ready(function(){
$('#tSorted').dataTable();
});
[/code]

My table can be viewed here: http://tinkerbin.com/McMIio6P

I get an error saying a.aoColumns[c] is undefined ?
Please help me, thanks for reading. :)

Greetings

Replies

  • allanallan Posts: 63,516Questions: 1Answers: 10,472 Site admin
    There are more columns in the tbody (7) than there are in the header (6).

    Allan
  • bidon2bidon2 Posts: 20Questions: 2Answers: 0
    Thanks, didn't notice that at all!
    Thank you for your help!

    Greetings
  • bibin71554bibin71554 Posts: 10Questions: 0Answers: 0
    I
    F
    L
    E
    P
    U
    f





    a
    b
    c
    d
    e
    f
    g





    in my purchased template have only 6 TDs example so i think some where its looking for 6 TDs ... if am trying to add more than 6 TDs getting this error "TypeError: a.aoColumns[c] is undefined"


    Please help me

    Thanks in advance !!
  • allanallan Posts: 63,516Questions: 1Answers: 10,472 Site admin
    Please link to a test case.

    Allan
  • bibin71554bibin71554 Posts: 10Questions: 0Answers: 0
    edited February 2013
    Hi allan,

    http://debug.datatables.net/irumak


    here you can see debug info... If am using only 6 TD s that works fine but not works for more than 6 TDs

    Please help me
  • allanallan Posts: 63,516Questions: 1Answers: 10,472 Site admin
    Right enough, you are using only 6 TDs, but you are also using aoColumns which defines six columns. If you change the number of columns in the HTML, you must also change aoColumns .

    Allan
  • bibin71554bibin71554 Posts: 10Questions: 0Answers: 0
    Please ... where can i change "aoColumns" ? where its defines ?
  • bibin71554bibin71554 Posts: 10Questions: 0Answers: 0
    Is "aoColumns" hardcoded some where?
  • allanallan Posts: 63,516Questions: 1Answers: 10,472 Site admin
    Its in your initialisation code wherever that is. You mention you are using a template, so I guess it is in the template.
  • bibin71554bibin71554 Posts: 10Questions: 0Answers: 0
    Thanks a lot allan ,

    But have this issue

    i just initialize the code but right now its works but am getting this following JS alert message :(

    "DataTables warning (table id = 'dt_gal'): Cannot reinitialise DataTable.

    To retrieve the DataTables object for this table, pass no arguments or see the docs for bRetrieve and bDestro"
  • bibin71554bibin71554 Posts: 10Questions: 0Answers: 0
    edited February 2013
    http://debug.datatables.net/alujip

    here is debug details

    DataTable really good , thanks for your job
  • allanallan Posts: 63,516Questions: 1Answers: 10,472 Site admin
    Not sure how much I can help here - don't initialise DataTables twice, like the warning message is telling you. Why are you trying to initialise it twice?
  • bibin71554bibin71554 Posts: 10Questions: 0Answers: 0
    Allen Its solved .... now everything works fine !! i just removed alert message from datatableJS :)
  • allanallan Posts: 63,516Questions: 1Answers: 10,472 Site admin
    It is there for a reason, but okay...
  • bibin71554bibin71554 Posts: 10Questions: 0Answers: 0
    Yea allan..Now everything Ok.

    I have a suggestion , If someone comment in our discussion then go email for all active users for that purticular discussion . So everyone can help New guys..

    Please ignore if wrong

    Thanks
  • hans99084hans99084 Posts: 6Questions: 0Answers: 0
    Hi Allan,

    I'v got a similar problem: Firefox: FireBug: "TypeError: a.aoColumns[c] is undefined".

    In the thead I've got one th with colspan="2". If I add no tbody, I get no errors. But if there is a tbody with some td's, I get the error...

    http://pastebin.com/B0LMrFvJ

    Thank you.
  • allanallan Posts: 63,516Questions: 1Answers: 10,472 Site admin
    There must be at least one unique header cell for each column. Otherwise sorting can't be applied to individual columns.

    Allan
  • hans99084hans99084 Posts: 6Questions: 0Answers: 0
    Pity :(
    So if you have one or more column(s) that will not be sorted, you've got a problem...
This discussion has been closed.