Skip to content

Commit

Permalink
add comments and update README
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolasjesse committed May 15, 2023
1 parent d4eae3e commit 868d5b9
Show file tree
Hide file tree
Showing 6 changed files with 1,420 additions and 48 deletions.
28 changes: 4 additions & 24 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,35 +1,26 @@
# See http://help.github.com/ignore-files/ for more about ignoring files.

# compiled output

/dist
/tmp
/out-tsc

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# nyc test coverage
.nyc_output

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# IDEs and editors
.idea
.project
.classpath
Expand All @@ -38,54 +29,43 @@ bower_components
.settings/
*.sublime-workspace

# IDE - VSCode
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json

# misc
.sass-cache
connect.lock
typings

# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*


# Dependency directories
node_modules/
jspm_packages/

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env

# next.js build output
.next

# Lerna
lerna-debug.log

# System Files
.DS_Store
Thumbs.db
Thumbs.db

mochawesome-report
83 changes: 73 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,28 @@ Welcome to Lemon Data-Grid! This lightweight JavaScript library allows you to ef

Utilizing DataGridLM is straightforward. Just include the JavaScript file in your project and instantiate a new grid using the provided API. From there, you can effortlessly load data, define columns, and incorporate custom user actions as required.

### npm Installation

To install your project using npm, run the following command:
```bash
npm install @lemonadejs/datagrid
```

### CDN

To use DataGrid via a CDN, include the following script tags in your HTML file:
```html
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/lemonadejs/dist/lemonade.min.js"></script>
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/@lemonadejs/datagrid/dist/index.min.js"></script>
```
### npm Installation
### Usage

To install your project using npm, run the following command:
```bash
npm install @lemonadejs/datagrid
```
## Usage
There is two ways to instantiate a DataGrid, Programatically or Dinamically

#### Programatically

Create an instance of the data grid by providing the DOM element and the ***options*** object.

Instantiate the data grid by providing the required parameters, including the data and columns.
```html
<div id='root'></div>
<script>
Expand All @@ -45,9 +51,33 @@ Instantiate the data grid by providing the required parameters, including the da
})
</script>
```
## Configuration

You can also add ***pagination*** and ***search*** functionalities by adding it to the options. Eg:
#### Dynamically with LemonadeJS

The DataGrid is invoked within the template, with the options being passed as properties.


```javascript
function Component() {
let self = this

self.data = [
{ id: 1, person: 'Maria', age: 28 },
{ id: 2, person: 'Carlos', age: 33 }
]

self.columns = [
{ name: 'person', headerName: 'Name' },
{ name: 'age', headerName: 'Age' },
]

return `<Datagrid data="{{self.data}}" columns="{{self.columns}}" />`
}
```

### Configuration

Additionally, you have the option of incorporating ***pagination*** and ***search*** functionalities by including them in the options. For example:
```javascript
Datagrid(root, {
data: [
Expand All @@ -62,14 +92,47 @@ Datagrid(root, {
search: true,
})
```
## Examples
### Examples

Here are a few examples of DataGridLM in action:

- [Basic Data Grid Example](https://lemonadejs.net/components/datagrid#example-1)
- [Example with Large Data Sets](https://lemonadejs.net/components/datagrid#example-2)
- [Example with Data Addition and Deletion](https://lemonadejs.net/components/datagrid#example-3)

## Development

### Running the project

To run the project in development mode, use the following command:

```bash
$ npm i
$ npm start
```

This will start a web-server with a DataGrid page as playground.

### Running Tests

After installing the packages run:

```bash
$ npm run test
```

To see more details in a browser:

```bash
$ npm run test:browser
```

To have more information about test coverage:

```bash
$ npm run test:coverage
```

## Contributing

DataGridLM is an open source project and contributions are welcome! If you find a bug or have a feature request, please open an issue on GitHub. If you'd like to contribute code, please fork the repository and submit a pull request.
Expand Down
Loading

0 comments on commit 868d5b9

Please sign in to comment.