NodeJS libraries

As part of Editor, we publish Node.JS libraries to provide everything needed Editor and DataTables on the server-side, including:

  • Create, Read, Update and Delete (CRUD) operations
  • Field validation
  • Field formatters
  • Support for simple and complex joins
  • Uses Knex.JS for database abstraction

These libraries are available on npm as datatables.net-editor-server, which you can install using npm or yarn. The Editor example package for Node.JS will install those libraries when you run npm install.

This section of the Editor manual goes into detail about how to set up, configure and use the Editor NodeJS libraries.

Reference documentation is also available for Editor's Node.JS libraries, which document in detail the API interfaces and options of the classes and methods provided by the assembly.

Node.JS libraries manual

Installing

DataTables and Editor are powerful libraries, but before you can use them, they need to be installed on your system! This guide walks through how to download the C# Editor package and set it up. The end result will be the ability to run all of the Editor examples in your .NET environment. This installation is a simple four step process which the documentation below will guide you though. Read more »

Getting started

The NodeJS Editor libraries make it super quick for you to provide complex CRUD based web applications to end users. In order to achieve this we need to introduce the basic concepts of how the libraries operate and how you can use the interfaces that they provide to access your own databases. This page summarises how the Editor libraries operate and the concepts involved in using them. Read more »

Validation

Validation of data is of fundamental importance in CRUD applications. You need to be sure that the data that the client is sending you is what you expect! This is not just for security reasons, protecting your data from misuse and intentional corruption, but also simply from unintentional mistakes in submitting data. Strings limited to a certain length, dates in a particular format and required fields are all common uses of data validation. Read more »

Formatters

Often the data that is stored in the database is not in a format that is suitable for display or manipulate by the end user. A common example of this is a timestamp - the number of seconds since 1st January 1970 means very little to anyone, even extremely experienced developers, but it is a very useful format to hold the data in, since it can be sorted and filtered extremely quickly in the database. For this reason the Field class provides get and set formatters - specifically the getFormatter and setFormatter methods. Read more »

Joins

A cornerstone of CRUD applications is the ability to combine information from multiple SQL tables, representing the combined data as a common data set that the end user can easily understand and manipulate. Relational databases are, after all, designed for exactly this sort of data referencing. Often in CRUD applications, working with such joined data can significantly increase the complexity of the application and increase development time, Editor makes working with such join tables extremely easy through its leftJoin() method. Complex joins with full CRUD support can be added in just minutes. Read more »

One-to-many Joins

Editor's leftJoin() method is excellent when joining data which has a 1:1 relationship, however, often your data structure will require a one-to-many relationship. An example of this that is often used in the computing world is access privileges: a single user can have access to n systems (where n >= 0). To provide one-to-many support the Editor Node.JS libraries include an Mjoin class (i.e. many join). Read more »

Where Conditions

When displaying data from a database to an end user you may require the ability to filter the data that the end user sees (for example based on account permissions or some other account access permissions). In SQL you would do this with a WHERE condition - the Editor Node.JS libraries also provide a Editor.where() method to expose this functionality and allow complex conditional expressions. Read more »

Events

When working with complex data, it can often be useful to perform some additional action when Editor updates the database based on information from the client-side. This can take the form of modifying the Editor or Field instances for the action being taken, deleting files from the file system when rows are removed, or adding log information to a database about an action that a user has taken. To make this possible, the Node.JS Editor class provides an event listener / callback option similar to the events that the client-side Javascript will trigger. Read more »

File Upload

The Editor Node.JS libraries provide an Upload class that can be used with the upload and uploadMany field types to provide end users with the ability to upload files to a server. The goal of the Upload class is to make the server-side aspect of file uploading as simple as possible, while retaining the same flexibility that you would expect from the Editor libraries. Read more »