adding sWidth causing 'Uncaught TypeError: Object [object Object] has no method 'charCodeAt'

adding sWidth causing 'Uncaught TypeError: Object [object Object] has no method 'charCodeAt'

partyboypartyboy Posts: 18Questions: 0Answers: 0
edited February 2013 in General
Hi,

I'm trying to add the sWidth parameter, but no matter where I try to put it (aoColumnDefs or aoColumns) I'm getting : Uncaught TypeError: Object [object Object] has no method 'charCodeAt'

Here is my init code :

[code]
rfTable = $('.data-table').dataTable( {
"aaSorting": [[ 0, "desc" ]],
"bJQueryUI": true,
"sPaginationType": "full_numbers",
"aoColumns": [
{ "mData": "dateCreated", "sWidth": "5%" },
{ "mData": "name", sDefaultContent: "" },
{ "mData": "email", sDefaultContent: "" },
],
"bProcessing": true,
"bServerSide": true,
"bPaginate":true,
"fnServerData": fnDataTablesPipeline,
"sAjaxSource": "/userManagement/admin/search2",
"sServerMethod": "POST"
} );
[/code]
This sample has same effect :

[code]
rfTable = $('.data-table').dataTable( {
"aaSorting": [[ 0, "desc" ]],
"bJQueryUI": true,
"sPaginationType": "full_numbers",
"aoColumnDefs": [
{ "sWidth": "20%", "aTargets": [ 0 ] }
],
"aoColumns": [
{ "mData": "dateCreated"},
{ "mData": "name", sDefaultContent: "" },
{ "mData": "email", sDefaultContent: "" },
],
"bProcessing": true,
"bServerSide": true,
"bPaginate":true,
"fnServerData": fnDataTablesPipeline,
"sAjaxSource": "/userManagement/admin/search2",
"sServerMethod": "POST"
} );
[/code]

Replies

  • partyboypartyboy Posts: 18Questions: 0Answers: 0
    forgot to say : I use jquery 1.9.1 and datatables 1.9.4.

    The error is situated in line : 3879 in datatables.js (not minified)
  • allanallan Posts: 63,523Questions: 1Answers: 10,473 Site admin
    Are you using jQuery UI and if so, what version? Old versions have a bug that interfere with jQuery's width functions and cause this error.

    Allan
  • partyboypartyboy Posts: 18Questions: 0Answers: 0
    Yes, I'm using jquery ui 1.8.21 but if it's the problem I can update.

    Thanks
  • allanallan Posts: 63,523Questions: 1Answers: 10,473 Site admin
    That's the problem... :-)

    Allan
  • partyboypartyboy Posts: 18Questions: 0Answers: 0
    Thanks Allan, problem fixed !
This discussion has been closed.