// ! Support file only, run Tree.html instead ! //. This file is used as both data url and SaveUrl //. Generates data for FastGrid by get() function or saves received changes to database by set() function // ----------------------------------------------------------------------------------------------------------------------------- //. Reads data from database and returns them in JSON function get(req,res){ var sql = require('better-sqlite3'), db = new sql('SQLite.db'); //. It uses SQLite3 database engine on database in file SQLite.sb try { var rows = db.prepare("SELECT * FROM TreeData ORDER BY (SELECT TRIM(pid || ' ' || id))").all(); } //. Selects the whole table and calls the process function with the results catch(e){ err("SQL select error: "+e.message,res); return; } var s = "FGrid.Data={Body:[", F = "],Foot:["; for(var i=0;i