Trying To Use datatables.net-editor-server For Node.js

Trying To Use datatables.net-editor-server For Node.js

paulprrnpaulprrn Posts: 2Questions: 2Answers: 0

Is this package ready for developers to work with? (Rough around the edges would be OK.)
What version of Node.js do I need to be running?
Do I need to compile the Typescript in my environment, or should the javascript files that came with the package work?
Am I instantiating the Editior correctly?
Is there a complete example available anywhere?

———— My Application Calling the Editor————————————————————

var mysql = require('mysql');
var dataTablesEditor = require('datatables.net-editor-server');
//First Attempt To Use The Node-Editor Module From GitHub

module.exports = {
    invokeEditor: function (req, res) {
        console.log("InvokeEditor: Start");
        var con = mysql.createConnection({
            host: "localhost",
            port: “XXXX",
            user: “XXXXXXX",
            password: “XXXXXXXXX",
            database : "dtab_demo"
        });
      var editorInst = dataTablesEditor.Editor(con, "dtab_demo", "id”);
      console.log(editorInst);
    }
}

——————— What I Get In The Node.Js Console —————————————————————

InvokeEditor: Start
TypeError: _this.db is not a function
    at Object.Editor (/Sonario/Data Loading/Data Tables/dataTableNode/node_modules/datatables.net-editor-server/dist/editor.js:121:19)
    at Object.module.exports.invokeEditor (/Sonario/Data Loading/Data Tables/dataTableNode/demo_db_connection_05.js:22:43)
    at /Sonario/Data Loading/Data Tables/dataTableNode/app.js:32:23
    at Layer.handle [as handle_request] (/Sonario/Data Loading/Data Tables/dataTableNode/node_modules/express/lib/router/layer.js:95:5)
    at next (/Sonario/Data Loading/Data Tables/dataTableNode/node_modules/express/lib/router/route.js:137:13)
    at Route.dispatch (/Sonario/Data Loading/Data Tables/dataTableNode/node_modules/express/lib/router/route.js:112:3)
    at Layer.handle [as handle_request] (/Sonario/Data Loading/Data Tables/dataTableNode/node_modules/express/lib/router/layer.js:95:5)
    at /Sonario/Data Loading/Data Tables/dataTableNode/node_modules/express/lib/router/index.js:281:22
    at Function.process_params (/Sonario/Data Loading/Data Tables/dataTableNode/node_modules/express/lib/router/index.js:335:12)
    at next (/Sonario/Data Loading/Data Tables/dataTableNode/node_modules/express/lib/router/index.js:275:10)

Answers

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin

    Hi,

    You've jumped the starting pistol with this one just a little :). The Editor Node libraries are going to be the main part of Editor 1.7, and that will include full documentation and examples. The libraries are actually ready (and published), I just need to wrap up writing the documentation before 1.7 is published itself.

    What I can do, if you are interested in beta testing the libraries perhaps, is package the example suite up and e-mail it over - is your e-mail address in your profile the one to use? That includes all of the examples that are on the Editor site ported over to the Node libraries for Editor.

    The main issue with the above code you posted, is that the libraries use KnexJS for the database abstraction, allowing it to work with MySQL, Postgres, SQL Server, etc with just a single change.

    Regards,
    Allan

  • UMR5558UMR5558 Posts: 41Questions: 13Answers: 0

    Hello Allan.
    Is it possible tu download the 1.7 editor librairies whith examples and without the documentation. I would like to port my php project on node but i must test it before.
    Thanks for your help
    Lionel

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin

    Not yet. I'm hoping to get the documentation finished off next week and the examples ready to be downloaded as well.

    Allan

This discussion has been closed.