Skip to content

Added new features #392

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,28 @@
# Changelog

## 2.0.0

### Enhancements & Features
- Added localStorage to store states of:
⋅ search filters
⋅ pagination
⋅ column visibility
⋅ row count
- Now you can:
⋅ Add advanced filters
⋅ Add action links inside bootgrid header row
⋅ Add action links inside a table td that will be wrapped in a dropdown
⋅ Format a table td without use common formatter
⋅ Pass header Authorization to ajax request
⋅ Load ajax response with a different rows wrapper
⋅ Call encapsulated json elements in data-column-id
- Fixed table td links with data-remote and data-confirmation
- Changed default icon library to *FontAwesome*

### Breaking Changes
There are no breaking changes but some HTML templates changed during development. In case you want to use the full new feature set be sure you did not override any affected templates.
See [README](http://github.com/correalucas/jquery-bootgrid) for more details.

## 1.3.1

### Enhancements & Features
Expand Down
2 changes: 1 addition & 1 deletion Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ module.exports = function (grunt)
files: [
{
flatten: true,
expand: true,
expand: true,
src: ['<%= folders.dist %>/*.js', '<%= folders.dist %>/*.css'], dest: '/'
}
]
Expand Down
105 changes: 84 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
jQuery Bootgrid Plugin [![Build Status](http://img.shields.io/travis/rstaib/jquery-bootgrid/master.svg?style=flat-square)](https://travis-ci.org/rstaib/jquery-bootgrid) ![Bower version](http://img.shields.io/bower/v/jquery.bootgrid.svg?style=flat-square) ![NuGet version](http://img.shields.io/nuget/v/jquery.bootgrid.svg?style=flat-square) ![NPM version](http://img.shields.io/npm/v/jquery-bootgrid.svg?style=flat-square) ![Gratipay](http://img.shields.io/gratipay/RafaelStaib.svg?style=flat-square)
jQuery Bootgrid Plugin [![Build Status](http://img.shields.io/travis/rstaib/jquery-bootgrid/master.svg?style=flat-square)](https://travis-ci.org/rstaib/jquery-bootgrid) ![Bower version](http://img.shields.io/bower/v/jquery.bootgrid.svg?style=flat-square) ![NuGet version](http://img.shields.io/nuget/v/jquery.bootgrid.svg?style=flat-square) ![NPM version](http://img.shields.io/npm/v/jquery-bootgrid.svg?style=flat-square)
============

Nice, sleek and intuitive. A grid control especially designed for bootstrap.
Expand All @@ -16,29 +16,92 @@ Everything you need to start quickly is:
```html
<!DOCTYPE html>
<html>
<head>
<title>Demo</title>
<meta charset="utf-8">
<!-- Styles -->
<link href="bootstrap.css" rel="stylesheet">
<link href="jquery.bootgrid.css" rel="stylesheet">
</head>
<body>
<table id="grid" data-toggle="bootgrid" data-ajax="true" data-url="/api/data/basic" class="table table-condensed table-hover table-striped">
<thead>
<tr>
<th data-column-id="id">ID</th>
<th data-column-id="name">Sender</th>
</tr>
</thead>
</table>
<!-- Scripts -->
<script src="jquery.js"></script>
<script src="jquery.bootgrid.js"></script>
</body>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>jQuery Bootgrid Demo</title>
<link href="bootstrap.css" rel="stylesheet" />
<link href="fontawesome.css" rel="stylesheet">
<link href="jquery.bootgrid.css" rel="stylesheet" />
</head>
<body>
<div class="container-fluid">
<table id="grid" data-toggle="bootgrid" data-url="data.json" data-ajax="true" data-wrapper="" class="table">
<thead>
<tr>
<th data-column-id="actions" data-width="50"></th>
<th data-column-id="id" data-identifier="true" data-type="numeric">ID</th>
<th data-column-id="sender.email">Sender</th>
<th data-column-id="received">Received</th>
</tr>
</thead>
</table>
</div>

<script src="jquery.js"></script>
<script src="bootstrap.js"></script>
<script src="jquery.bootgrid.js"></script>
</body>
</html>
```

### New features

Set Authorization header to ajax response
```html
localStorage.setItem("ajax-authorization", "my-api-authorization");
```

Replace default row wrapper from ajax response by changing wrapper option.
<code>data-wrapper=""</code> indicates that json rows will be in root directory.

Add action links to your table adding a action-links option like this:

```html
<th data-column-id="actions" data-width="50" data-action-links="myActionLinks"></th>
```
and this column will call a referenced div with the same action links id like this one:

```html
<div data-action-links-id="myActionLinks">
<a href="link_to_view/{id}">View {sender.email}</a>
bootgridExecute[
if('{sender.email}' == '[email protected]') {
'<a href="link_to_edit/{id}">Edit {sender.email}</a>'
}
]end
</div>
```

Add a html formatter by adding the html-formatter option to your column like this:
```html
<th data-column-id="sender.email" data-html-formatter="myHtmlFormatter">Sender</th>
```
and this column will call a referenced div with the same html formatter. You can also execute javascript wrapped in <code>bootgridExecute[javascript code here]end</code> like this:
```html
<div data-html-formatter-id="myHtmlFormatter">
<span class="label label-bootgridExecute['{sender.email}' == '[email protected]' ? 'success' : 'warning']end">{sender.email}</span>
</div>
```

Everything inside a div with bootgrid-buttons-id option will be placed in the header row, example:
```html
<div data-bootgrid-buttons-id="grid">
<a href="link_to_new" class="btn btn-info">New</a>
</div>
```

Add advanced filters by adding a div with options data-bootgrid="custom-filters" and bootgrid-id referencing the table id, example:
```html
<div data-bootgrid="custom-filters" data-bootgrid-id='grid' class="custom-filters">
<div class="row">
<div class="col-sm-1">
<input type="text" id="id" name="id" class="form-control" placeholder="ID">
</div>
</div>
</div>
```

> For more information [check the documentation](http://www.jquery-bootgrid.com/Documentation).

### Examples
Expand Down
7 changes: 4 additions & 3 deletions bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"accessibility",
"bootstrap"
],
"version": "1.3.1",
"version": "2.0.0",
"authors": [
{
"name": "Rafael Staib",
Expand Down Expand Up @@ -48,7 +48,8 @@
"package.json"
],
"dependencies": {
"jquery": ">=1.9.0",
"bootstrap": ">=3.1.1"
"jquery": ">=3.0.0",
"bootstrap": ">=3.1.1",
"fontawesome": ">=4.7.0"
}
}
61 changes: 33 additions & 28 deletions demo/data.json
Original file line number Diff line number Diff line change
@@ -1,32 +1,37 @@
{
"current": 1,
"rowCount": 5,
"rows": [
{
"id": "a0e3a286-4343-4240-8d6d-e79fa2e94b4c",
"sender": "[email protected]",
"received": "2014-04-17 15:08:03Z"
[
{
"id": "a0e3a286-4343-4240-8d6d-e79fa2e94b4c",
"sender": {
"email": "[email protected]"
},
{
"id": "dd9f2d42-9442-404c-8d2a-dd3bd2156c03",
"sender": "[email protected]",
"received": "2014-04-16 15:19:31Z"
"received": "2014-04-17 15:08:03Z"
},
{
"id": "dd9f2d42-9442-404c-8d2a-dd3bd2156c03",
"sender": {
"email": "[email protected]"
},
{
"id": "e9b8ede5-c1bf-4d90-b724-e7379b25f7b3",
"sender": "[email protected]",
"received": "2014-04-16 15:17:05Z"
"received": "2014-04-16 15:19:31Z"
},
{
"id": "e9b8ede5-c1bf-4d90-b724-e7379b25f7b3",
"sender": {
"email": "[email protected]"
},
{
"id": "153d3acb-efe7-4b5f-a3a9-e8ac18bdec30",
"sender": "[email protected]",
"received": "2014-04-16 15:17:05Z"
"received": "2014-04-16 15:17:05Z"
},
{
"id": "153d3acb-efe7-4b5f-a3a9-e8ac18bdec30",
"sender": {
"email": "[email protected]"
},
{
"id": "49bad60a-bbf7-42bf-b040-d901805ccbf1",
"sender": "[email protected]",
"received": "2014-04-15 11:23:06Z"
}
],
"total": 5
}
"received": "2014-04-16 15:17:05Z"
},
{
"id": "49bad60a-bbf7-42bf-b040-d901805ccbf1",
"sender": {
"email": "[email protected]"
},
"received": "2014-04-15 11:23:06Z"
}
]
Loading