Atozed Forums
Warning from Datatables - Printable Version

+- Atozed Forums (https://www.atozed.com/forums)
+-- Forum: Atozed Software Products (https://www.atozed.com/forums/forum-1.html)
+--- Forum: IntraWeb (https://www.atozed.com/forums/forum-3.html)
+---- Forum: English (https://www.atozed.com/forums/forum-16.html)
+----- Forum: IntraWeb General Discussion (https://www.atozed.com/forums/forum-4.html)
+----- Thread: Warning from Datatables (/thread-1317.html)



Warning from Datatables - matija - 10-15-2019

I create my HTML table (datatables.net) include IWLabel raw text

<table id="mytable" class="table table-hover table-striped table-condensed dt-responsive nowrap" width="100%" cellspacing="0">
...
</table>

I have in my HTML template {%mytable%} and this style:
<style>
.sunday {
  background-color: red !important;
}

</style>

After view IWLabel send (color row with red which are sunday):

WebApplication.CallBackResponse.AddJavaScriptToExecute
        ('$(document).ready( function () {'
        + 'var table = $("#mytable").DataTable({'
        + '"createdRow": function(row, data, dataIndex)'
        + '{ if (data[2] == "sun") {$(row).addClass("sunday");} }'
        + '});'
        + '}) ');


After AddJavaScriptToExecute get it:
DataTables warning: Non-table node initialisation (SPAN). For more information about this error, please see http://datatables.net/tn/2


RE: Warning from Datatables - kudzu - 10-15-2019

This is not an IW error or related to IW itself.

DataTables like most JQ related UI libraries are very very brittle. 17 supports DataTables.NET and more and its a constant area that gets broken but the tiniest of subtle changes.

I suggest breaking down your JS into discrete pieces and locate exactly which call is causing that error and then digging in from there using the browsers JS debugger and breakpoints.


RE: Warning from Datatables - Alexandre Machado - 10-22-2019

Please try WebApplication.CallBackResponse.AddJavaScriptToExecuteAsCDATA() instead. It will send your javascript as is to the browser.


RE: Warning from Datatables - matija - 07-16-2020

(10-22-2019, 08:40 AM)Alexandre Machado Wrote: Please try WebApplication.CallBackResponse.AddJavaScriptToExecuteAsCDATA() instead. It will send your javascript as is to the browser.

This not work!

I try with WebApplication.CallBackResponse.AddJavaScriptToExecuteAsCDATA and WebApplication.CallBackResponse.AddJavaScriptToExecute
and show mesage DataTables warning: Non-table node initialisation (SPAN). For more information about this error, please see http://datatables.net/tn/2



RE: Warning from Datatables - Alexandre Machado - 07-17-2020

> Non-table node initialisation (SPAN).

Means that your JavaScript is wrong. It has nothing to do with IntraWeb.

I believe you are calling the DataTable() method using the IWLabel and not the correct <table> element.

I just created a demo with that same code and everything works correctly:

https://github.com/Atozed/IntraWeb/tree/master/15/Delphi/DataTables_template