datatables data-data function problem

when i using this code in html5 datatables, will show out console error
A[c[B]] is not a function.

i fix this issue when i change the code from datatables.bundle.js to
A= window[c[B]](A);

this is my html code.




ID
Folder
Web
Element
English
Chinese
Date
Time
Function




Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(

Replies (5)

Deleted comment
Deleted comment

when i using this code in html5 datatables, will show out console error
A[c[B]] is not a function.

i fix this issue when i change the code from datatables.bundle.js to
A= window[c[B]](A);
// A = A[c[B]](); // this is original code from datatables.bundle.js

the error problem detected from web_lan_function() data-data
this is my html code.

<table class="table table-bordered table-striped table-row-bordered table-hover table-data" 
data-url="../../sql/web_lan/get_info_by_folder_and_web.php">
<thead>
<tr>
<th data-data="lan_id" data-class="text-center" class="min-w-50px">ID</th>
<th data-data="folder" data-class="" class="" data-visible="false">Folder</th>
<th data-data="web" data-class="" class="" data-visible="false">Web</th>
<th data-data="element" data-class="" class="">Element</th>
<th data-data="en" data-class="" class="">English</th>
<th data-data="cn" data-class="" class="">Chinese</th>
<th data-data="reg_date" data-class="" class="" data-visible="false">Date</th>
<th data-data="reg_time" data-class="" class="" data-visible="false">Time</th>
<th data-data="web_lan_function()" data-class="mw-100px">Function</th>

</tr>
</thead>

</table>

can someone help me to fix this issue please?

Hi,

Could you please let us know which template, framework and demo are you referring to ? Could you please provide us a URL or screenshot ?

Please note that the code must be modified in the source folder then you need to recompile your assets folder with Gulp or Webpack.

Please note that the build tools are required only in the development environment just to compile the assets when the source folder files are modified. In the hosting/server deployment you will only need the compile assets, no need to install the build tools dependencies there.

Regards.

i using metronic demo27 template. and this issue actually happen in all demo template. this is just a small problem that i would let u know.

this is the html code.

<div class="table-responsive">
<table class="table table-bordered table-striped table-row-bordered table-hover table-data"
data-url="../../sql/web_lan/get_info_by_folder_and_web.php">
<thead>
<tr>
<th data-data="lan_id" data-class="text-center" class="min-w-50px">ID</th>
<th data-data="folder" data-class="" class="" data-visible="false">Folder</th>
<th data-data="web" data-class="" class="" data-visible="false">Web</th>
<th data-data="element" data-class="" class="">Element</th>
<th data-data="en" data-class="" class="">English</th>
<th data-data="cn" data-class="" class="">Chinese</th>
<th data-data="reg_date" data-class="" class="" data-visible="false">Date</th>
<th data-data="reg_time" data-class="" class="" data-visible="false">Time</th>
<th data-data="test_func()" data-class="mw-120px">Function</th>

</tr>
</thead>

</table>
</div>

this is the js code that i init datatables.

$(".table-data").each(function(){

var url= $(this).attr("data-url");
var param= $(this).attr("data-param") != "" ? window[$(this).attr("data-param")] : null;
var serverSide= typeof $(this).attr("data-serverSide") != "undefined" ? true : false;
var ajax= url != undefined || param != null ? {url:url,data:param,type:"POST",dataSrc:""} : null;
if(serverSide == true && ajax != null){ajax.dataSrc = "data";}
var searchDelay= serverSide == true ? 1000 : 0;
$(this).dataTable({
responsive: false,
paging: true,
dom: dom,
buttons: buttons,
language: {url: lanPath},
ajax:ajax,
searchDelay:searchDelay,
//fixedHeader:true,
"processing": true,
"serverSide": serverSide,
"columnDefs": [{
"render": function ( data, type, row ) {return data;},
"targets": 0
},
{ "visible": true, "targets": [ 0 ] }
],
"fnDrawCallback" : function(){ //显示编号 - 每个表格的首列必须留给编号

//手动更换datatable的按钮组件
if(web_lan.get() == LANGUAGE_CN){
$(".buttons-colvis > span").text("内容");
$(".buttons-colvis .dt-down-arrow").text("");

// alert($(".buttons-colvis > span").text());
$(".buttons-copy > span").text("复制");
$(".buttons-print > span").text("打印");
}

  this.api().column(0).nodes().each(function(cell, i) {
    cell.innerHTML = i + 1;
  });
},
});
});

this error just easily to fix when i change the code from datatables.bundle.js

error problem detected : data-data="test_function()"

if i using data-data="username"
(php responded this data field) that have nice working.
just have a problem when i using data-data for js function.

firefox console will show the error A[c[B]] is not a function.

Hi,

Sorry for the late reply. Noted, we will double check and fix the issue in a future update as soon as possible.

Regards.

Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(
Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(