Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Warning from Datatables
#1
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
Reply
#2
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.
Reply
#3
Please try WebApplication.CallBackResponse.AddJavaScriptToExecuteAsCDATA() instead. It will send your javascript as is to the browser.
Reply
#4
(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
Reply
#5
> 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/...s_template
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)