> For the complete documentation index, see [llms.txt](https://jorat.gitbook.io/dynamic-table/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://jorat.gitbook.io/dynamic-table/dynamic-table-library.md).

# Dynamic Table Library

The Dynamic Table Library is a JavaScript library designed for rendering JSON data as dynamic tables in HTML. This documentation provides an overview of how to use the library and its features.

## Installation&#x20;

You can install the Dynamic Table Library using NPM:

&#x20;`npm install dynamic-table-json`&#x20;

## Usage

Importing the LibraryTo use the library in your JavaScript project, import it as follows:

`const DynamicTable = require('dynamic-table');`

&#x20;Example JSON Data Before rendering a dynamic table, you need JSON data. Here's an example:

```
const jsonData = [ 
{ "CUSTOMERID": "43996", "MONTHCODE": "72023", "BUYER_NUMBER": "8682041077", "BUYER_NAME": "Joseph Rajakumaran T", "MAKE": "Maruti", "MODEL": "Swift", "PINCODE": "600017" }, 
// Additional data objects here... ]; 
```

### HTML Element&#x20;

Add an HTML element to your page where you want to display the table. Provide it with an ID

```
<div id="DivTempTable1"></div>
```

## &#x20;Rendering a Dynamic Table

Use the `DynamicTable.renderTable(options);` function to render a dynamic table. Here's an example:

```
DynamicTable.renderTable({ 
jsonData: jsonData, 
targetElementId: 'DivTempTable1', 
columnModifiers: [
["1", "<a id='{{td}}'><i class='bi bi-pencil-square'></i></a>"], 
], 
tableClasses: ["table", "table-striped", "table-hover", "table-bordered"] });
```

## Options

1. **jsonData**: An array of JSON data to populate the table.&#x20;
2. **targetElementId**: The ID of the HTML element where the table should be rendered.&#x20;
3. **columnModifiers**: An array of column modifiers for adding elements to specific columns.&#x20;
4. **tableClasses**: An array of CSS/Bootstrap classes to apply to the table.

## API Reference

DynamicTable.renderTable(options)Renders a dynamic table based on the provided options.

## License

This library is licensed under the MIT License. See the LICENSE file for details.

## Contributing

Contributions to this library are welcome! Please read the CONTRIBUTING.md file for guidelines.

## Issues and Support

If you encounter any issues or have questions, please open an issue in the project's repository.
