In a desktop business application, selecting a customer in a grid often updates the fields beside it. Move to another row and those fields follow. An editor and a grid can share the same record because both are bound to a data source that knows which row is current.
TripousJS brings that programming model to the browser. It is a standalone JavaScript and CSS library for building data-entry forms, editable grids, dialogs, and other controls with plain HTML and JavaScript. If you have worked with data-aware controls in WinForms or Delphi, the idea will feel familiar.
TripousJS on GitHub
Live demos
From a data table to a grid
The library uses the global tp namespace. Its data model starts with four types.
-
tp.DataTableholds a table in memory. -
tp.DataColumndescribes a field, including its type. -
tp.DataRowholds one record. -
tp.DataSourcetracks the current row and notifies bound controls when the data or position changes.
With the TripousJS scripts and styles loaded, a grid can bind to a table using this markup and JavaScript.
<div id="CustomerGrid" style="height: 280px"></div>
var Customers = new tp.DataTable("Customers");
Customers.AddColumn({ Name: "Code", Title: "Code", DataType: tp.DataType.String });
Customers.AddColumn({ Name: "Name", Title: "Customer", DataType: tp.DataType.String });
Customers.AddRow(["C-001", "Acme Ltd"]);
Customers.AddRow(["C-002", "Northwind Traders"]);
Customers.AcceptChanges();
var Grid = new tp.Grid({ ElementOrSelector: "#CustomerGrid", AutoGenerateColumns: true });
Grid.DataSource = Customers;
The same tp.Grid supports editing, lookup columns, filtering, grouping, and summaries. A lookup column can show a department name while the record stores the department ID. In the example below, the grid groups records by department and region and calculates totals for each group and for the whole table.
Try the grouping and summaries demo
A control model built around the DOM
tp.Object provides the event model used by components and data objects. tp.Component builds on it and gives a component a DOM element. A component can create that element or wrap an existing one. You can pass settings in a CreateParams object or declare them in HTML with a data-setup attribute. tp.Control adds common behavior for data-aware controls, including hooks for changes to the bound data and current row.
The library includes text and numeric editors, combo boxes, lists, trees, menus, and toolbars. This form uses tp.CtrlRow to keep labels aligned across controls with very different heights.
Dialogs follow the same component model. tp.MessageDialog builds on tp.Window, and helpers such as tp.YesNoBoxAsync() let an event handler await the user's answer before continuing.
Try the notification dialogs demo
Using TripousJS and exploring the demos
For ASP.NET Core applications, the repository includes a Razor Class Library that serves the shared JavaScript, CSS, fonts, and images under /_content/TripousJS/. The demo application references that library. The same HTML demos also run on GitHub Pages as a static site, with JavaScript and CSS built from the same source assets.
TripousJS is a sibling project of Tripous.Seven, a C# framework that uses TripousJS. Both projects are part of the Tripous family of tools for data-centric applications.



Top comments (0)