ADOM & AdomScript.js for SPA
What is AdomScript?
ADOM returns data as XML, which is easily converted to JSON (or you can serialize your data model as JSON). AdomScript was made to work with these JSON objects, providing the developer with ways to easily display and save data. The consistency of the XML structure returned by ADOM allows for a custom front-end framework that binds data and HTML elements together.
Why it Matters
While ADOM can easily be used to update class objects to coincide with any changes a developer has made on the database – AdomScript allows a developer to skip the back-end almost entirely and begin binding data to forms on a browser. All that is needed is the JSON object returned by ADOM, and AdomScript’s custom functions can be utilized to display data via Table and Column names.
The ADOM Framework combined with the AdomScript.js library's development approach gives the Single-Page App (SPA) developer a truly simplified approach to connecting the data on the back-end with the UI.
Developing with Data
Using AdomScript is as simple as knowing which pieces of data are needed.
For example, if you are creating a form to allow users to update their street address, your form will reference the Address table using Column names.
One example being: HTML inputs that reference Address.AddressLine1 and Address.AddressLine2.
This approach allows for forms – themselves – to be JSON objects. If you needed a Drop-Down List that references another table, AdomScript will handle it.
In the above example, AdomScript is being used to output a Drop-Down List (using Bootstrap 4 CSS classes) referencing the Address Type.
When provided to AdomScript, the example JSON created the element and bound it to its data source. Because of the fact that the HTML elements share the name of the Column/Table they belong to, a simple loop through the inputs can update the developer’s copy of their JSON object. Saving these changes is as easy as passing the JSON back and converting to XML for ADOM to take over. Creates, Updates, and Deletes are determined by a ModifyTypeID.
A record can be created at the same time other records are edited or deleted. For this reason, AdomScript allows for Single-Page Applications to be developed faster than ever.