Hi All,
I have created a custom page and all works very nicely.
Next I had to display a table.
DataTables have some nifty features, and I ended up downloading from: https://datatables.net/download/
As for the setup, I tried the following options (so as to avoid reloading JQuery / Bootstrap):
UI: datatables
Package: datatables,
and:
UI: jQuery UI
Package: datatables,
I followed https://community.nodebb.org/topic/734/loading-external-scripts-with-requirejs/5. In addition, I added define.amd=0 above datatable's js to escape:
(function( factory ) {
"use strict"; if ( typeof define === 'function' && define.amd ) {
// AMD
define( ['jquery'], function ( $ ) {
return factory( $, window, document );
} );
}
My client's plugin code is as follows:
define('forum/client/plugins/myfile', ['translator', 'benchpress', 'moment'], function (translator, Benchpress) {
var myDataTables= {}; myDataTables.init = function () {
jQuery('document').ready(function() {
requirejs(['plugins/nodebb-plugin-myplugin/static/lib/datatables.js'], function (dataTable) { my code...
The table loads up, and looks nice and cool.
The problem follows: when I attempt to browse back into the forum (from the custom page), pages won't load up. The server does gets a request, but the client just does not display anything.
By the way, I tried loading DataTable's JS by including it in the project's json file (removing the requiredjs), with no luck.
I know I screwed up somewhere, just can't figure this one out.
Any help will be highly appreciated!
JJ