sAjaxSource doesn't read aoColumns from json

sAjaxSource doesn't read aoColumns from json

lqueryvglqueryvg Posts: 1Questions: 0Answers: 0
edited April 2010 in General
Hi,

Env: dataTables 1.6.2 with Firefox & Google Chrome

I'm trying to write a page that will display a table based on results from an ajax json query, but where the number of columns may vary. It would have been nice to be able to use sAjaxSource, but it would appear (after several frustrating hours) that it's not possible to pass aoColumns via sAjaxSource and have datatables automagically build the table columns.

I've since found this pretty much explained in the following thread and I'm now using the workaround proposed (which works fine, by the way)... http://datatables.net/forums/comments.php?DiscussionID=152

Currently, if you don't define the columns, the result is that the table doesn't appear at all because the Javascript bombs out. I've tried this with Firefox and Chrome and it was only when debugging in Chrome that I finally got to see the error message at line 5075 saying:

[code]
Uncaught TypeError: Cannot read property 'length' of null
[/code]

The line is...

[code]
for (i=0, iLen=bUseCols ? oInit.aoColumns.length : nThs.length ; i
This discussion has been closed.