Get 2024 Templates Mega Bundle!14 Bootstrap, Vue & React Templates + 3 Vector Sets
Get for 99$

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.

<table class="table table-bordered table-striped table-row-bordered table-hover table-data" id="table-web-lan">
<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>


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)


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(){ //&aelig;&#152;&frac34;&ccedil;&curren;&ordm;&ccedil;&frac14;&#150;&aring;&#143;&middot; - &aelig;&macr;&#143;&auml;&cedil;&ordf;&egrave;&iexcl;&uml;&aelig;&nbsp;&frac14;&ccedil;&#154;&#132;&eacute;&brvbar;&#150;&aring;&#136;&#151;&aring;&iquest;&#133;&eacute;&iexcl;&raquo;&ccedil;&#149;&#153;&ccedil;&raquo;&#153;&ccedil;&frac14;&#150;&aring;&#143;&middot;

//&aelig;&#137;&#139;&aring;&#138;&uml;&aelig;&#155;&acute;&aelig;&#141;&cent;datatable&ccedil;&#154;&#132;&aelig;&#140;&#137;&eacute;&#146;&reg;&ccedil;&raquo;&#132;&auml;&raquo;&para;
if(web_lan.get() == LANGUAGE_CN){
$(".buttons-colvis > span").text("&aring;&#134;&#133;&aring;&reg;&sup1;");
$(".buttons-colvis .dt-down-arrow").text("");

// alert($(".buttons-colvis > span").text());
$(".buttons-copy > span").text("&aring;&curren;&#141;&aring;&#136;&para;");
$(".buttons-print > span").text("&aelig;&#137;&#147;&aring;&#141;&deg;");
}

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


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  :(