aoColumns, aoColumnDefs with javascript data source
aoColumns, aoColumnDefs with javascript data source
keturn
Posts: 18Questions: 0Answers: 0
I just upgraded to 1.7beta3 for the column width fixes (nice work!), and I started looking at aoColumnDefs, as that flexibility looks useful. Being a little unsure how to go about changing my existing code, I just changed
{ aaData: [...], aoColumns: [...] } to { aaData: [...], aoColumnDefs: [...] }
and datatables died with "Uncaught TypeError: Cannot read property 'length' of null" on line 6001 (in the "Columns" section of the constructor, nThs is null.)
The element I'm applying datatables to is just " " (this project doesn't really speak "progressive enhancement").
I think the right thing to do for my use case is probably keep the aoColumns in there *and* add aoColumnDefs as needed, but I thought I'd submit this as a bug report as "Uncaught TypeError" is probably not the interface you wanted for this.
Thanks!
{ aaData: [...], aoColumns: [...] } to { aaData: [...], aoColumnDefs: [...] }
and datatables died with "Uncaught TypeError: Cannot read property 'length' of null" on line 6001 (in the "Columns" section of the constructor, nThs is null.)
The element I'm applying datatables to is just " " (this project doesn't really speak "progressive enhancement").
I think the right thing to do for my use case is probably keep the aoColumns in there *and* add aoColumnDefs as needed, but I thought I'd submit this as a bug report as "Uncaught TypeError" is probably not the interface you wanted for this.
Thanks!
This discussion has been closed.
Replies
Could you perhaps post your initialisation code for me? I haven't actually tried aoColumnDefs with aaData I don't think (I'll do so shortly). In theory the change that is needed for aoColumnDefs should simply be the name change, and adding aTargets[] to the column definition.
Regards,
Allan
[code]
{"aaData":[
[13,5,"early",1,44607600000,null],[7,4,"paint stuff",1,203986800000,null],
[6,4,"buy stuff",1,946670399000,null],[8,4,"eat great fries",1,1347087600000,null],
[12,5,"late task",1,1590994800000,null],[1,1,"step one",1,null,null]],
"aaSorting":[[4,"asc"]],
"aoColumnDefs":[
{"aTargets":[0],"bSearchable":false,"sClass":"taskID hide","sType":"numeric"},
{"aTargets":[1],"sClass":"tPlan","sTitle":"plan"},
{"aTargets":[2],"sClass":"tName","sTitle":"name"},
{"aTargets":[3],"sClass":"tOwner","sTitle":"owner"},
{"aTargets":[4],"bUseRendered":"false","sClass":"tDue","sTitle":"due","sType":"date"},
{"aTargets":[5],"sClass":"cT","sTitle":"done"}],
"bFilter":false,"bInfo":false,"bPaginate":false}
[/code]
Allan