uncaught typeerror: cannot read property 'aocolumns' of undefine in datatable jquery

HI ,

I am using datatable Jquery

I try this sample http://datatables.net/release-datatables/extensions/FixedColumns/examples/simple.html

I got error like uncaught typeerror: cannot read property 'aocolumns' of undefine in datatable jquery

how to solve this ??
LVL 20
Sathish David  Kumar NArchitectAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Sathish David Kumar NArchitectAuthor Commented:
and i didnt use CSS given in the link
0
Rainer JeschorCommented:
Hi,
can you please attach your code?
Thanks.
Rainer
0
Sathish David Kumar NArchitectAuthor Commented:
jQuery(function($) {
$(document).ready(function() {
    var cTable =$('#xxx').dataTable( {
        "scrollY":        "360px",
        "scrollX":        true,
        "scrollCollapse": true,
        "bFilter": false, 
        "bInfo": false,
        "paging":  false
    } );
     new $.fn.dataTable.FixedColumns( cTable );

   
} );} );

Open in new window

0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

Sathish David Kumar NArchitectAuthor Commented:
<table name='xxx1' id='xxx1' border=1 cellpadding='1' width='100%' cellspacing='0' bgColor='#C0C0C0'>
<thead>
<tr class='aaa'>
  <th>1&nbsp;<font color='red'>^</font></th>
  <th>2</th>
  <th>3</th>
  <th>4</th>
  <th>5</th>
  <th>6</th>
  <th>7</th>
  <th>8</th>
  <th>9</th>
  <th>10</th>
 
</tr>
 </thead> <tbody>   <table width='825'> <tr>
    <td>1</td>
  <td>2</td>
  <td>3</td>
  <td>4</td>
  <td>5</td>
  <td>6</td>
  <td>7</td>
  <td>8</td>
  <td>9</td>
  <td>10</td>
  </tr>
  <tr>
  <td>11</td>
  <td>12</td>
  <td>13</td>
  <td>14</td>
  <td>15</td>
  <td>16</td>
  <td>17</td>
  <td>18</td>
  <td>19</td>
  <td>20</td>
  </tr>
 
  <tr>
    <td>21</td>
  <td>22</td>
  <td>23</td>
  <td>24</td>
  <td>25</td>
  <td>26</td>
  <td>27</td>
  <td>28</td>
  <td>29</td>
  <td>30</td>
  </tr>
  <tr>
    <td>1</td>
  <td>2</td>
  <td>3</td>
  <td>4</td>
  <td>5</td>
  <td>6</td>
  <td>7</td>
  <td>8</td>
  <td>9</td>
  <td>10</td>
  </tr>
 
  </table>
 </tbody> </table>
0
Sathish David Kumar NArchitectAuthor Commented:
var cTable =$('#xxx1').dataTable( {
0
Rainer JeschorCommented:
Hi,
the main issue is that you have a TABLE tag inside your table body (tbody).
Just remove that and if you have referenced everything else it should work.
Sample based on your data (I added a couple of rows):
http://jsfiddle.net/EE_RainerJ/rv8vbsm7/

HTH
Rainer
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Sathish David Kumar NArchitectAuthor Commented:
ya i did before that its working fine thanks


is it possible to set height ? and width dynamically ?
  "scrollY":        "360px",
        "scrollX":        true,
0
Rainer JeschorCommented:
Hi,
what do you mean with "dynamically"?
For the plug-in to work correctly, the height has to be defined - if you want to set the value based on client size etc, then this should work.
Depending on your initial requirement - you might want to look at the FixedHeader extension for DataTables:
http://datatables.net/extensions/fixedheader/

HTH
Rainer
0
Sathish David Kumar NArchitectAuthor Commented:
Thanks Rainer .

dynamically means my table some time have 1 row only
some time 100
some time 200
some 3 rows

for 1 row and 3 rows also set in to same height which is for 100 and 200 rows ..

that is the problem  

I need to assign the   "scrollY":        "360px", value depends on table size or height

 var heightDy=$('#xxx1').height()-300; i tried but not work out
0
Sathish David Kumar NArchitectAuthor Commented:
main issue is 1st time table doesnt have value thats why its giving error
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
jQuery

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.