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
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
2 changes: 1 addition & 1 deletion Gruntfile.js
Original file line number Diff line number Diff line change
@@ -210,7 +210,7 @@ module.exports = function (grunt)
files: [
{
flatten: true,
expand: true,
expand: true,
src: ['<%= folders.dist %>/*.js', '<%= folders.dist %>/*.css'], dest: '/'
}
]
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.
@@ -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
7 changes: 4 additions & 3 deletions bower.json
Original file line number Diff line number Diff line change
@@ -13,7 +13,7 @@
"accessibility",
"bootstrap"
],
"version": "1.3.1",
"version": "2.0.0",
"authors": [
{
"name": "Rafael Staib",
@@ -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"
}
]
335 changes: 64 additions & 271 deletions demo/index.htm

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions demo/js/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
$(function(){
$("#grid").bootgrid().on("loaded.rs.jquery.bootgrid", function () {
$(this).find('[data-toggle=dropdown]').dropdown();
});
});
213 changes: 0 additions & 213 deletions demo/send.htm

This file was deleted.

Binary file removed dist/jQuery.Bootgrid.1.3.1.nupkg
Binary file not shown.
Binary file removed dist/jquery.bootgrid-1.3.1.zip
Binary file not shown.
54 changes: 37 additions & 17 deletions dist/jquery.bootgrid.css
Original file line number Diff line number Diff line change
@@ -1,8 +1,37 @@
/*!
* jQuery Bootgrid v1.3.1 - 09/11/2015
* Copyright (c) 2014-2015 Rafael Staib (http://www.jquery-bootgrid.com)
* jQuery Bootgrid v2.0.0 - 02/22/2018
* Copyright (c) 2014-2018 Rafael Staib (http://www.jquery-bootgrid.com)
* Licensed under MIT http://www.opensource.org/licenses/MIT
*/
div[data-html-formatter-id],
div[data-action-links-id],
div[data-bootgrid-buttons-id],
.customFilters {
display: none;
}
.actionBar {
display: flex;
flex-direction: row;
padding: 0 15px;
}
.actions .dropdown-menu li label {
margin: 0;
padding: 1px 10px;
width: 100%;
}
.actions .dropdown-menu li label:hover {
background: #f3f3f3;
}
.bootgridButtons {
flex: 1 1 auto;
}
.bootgridSearch {
flex: 1 1;
margin: 0 1.2em;
}
.buttonActions {
flex: 0 1 auto;
}
.bootgrid-header,
.bootgrid-footer {
margin: 15px 0;
@@ -14,9 +43,8 @@
.bootgrid-header .search,
.bootgrid-footer .search {
display: inline-block;
margin: 0 20px 0 0;
margin: 0;
vertical-align: middle;
width: 180px;
}
.bootgrid-header .search .glyphicon,
.bootgrid-footer .search .glyphicon {
@@ -36,38 +64,30 @@
.bootgrid-footer .pagination {
margin: 0 !important;
}
.bootgrid-header .actionBar,
.bootgrid-footer .infoBar {
text-align: right;
}
.bootgrid-header .actionBar .btn-group > .btn-group .dropdown-menu,
.bootgrid-footer .infoBar .btn-group > .btn-group .dropdown-menu {
text-align: left;
}
.bootgrid-header .actionBar .btn-group > .btn-group .dropdown-menu .dropdown-item,
.bootgrid-footer .infoBar .btn-group > .btn-group .dropdown-menu .dropdown-item {
cursor: pointer;
display: block;
margin: 0;
padding: 3px 20px;
white-space: nowrap;
}
.bootgrid-header .actionBar .btn-group > .btn-group .dropdown-menu .dropdown-item:hover,
.bootgrid-footer .infoBar .btn-group > .btn-group .dropdown-menu .dropdown-item:hover,
.bootgrid-header .actionBar .btn-group > .btn-group .dropdown-menu .dropdown-item:focus,
.bootgrid-footer .infoBar .btn-group > .btn-group .dropdown-menu .dropdown-item:focus {
color: #262626;
text-decoration: none;
background-color: #f5f5f5;
}
.bootgrid-header .actionBar .btn-group > .btn-group .dropdown-menu .dropdown-item.dropdown-item-checkbox,
.bootgrid-footer .infoBar .btn-group > .btn-group .dropdown-menu .dropdown-item.dropdown-item-checkbox,
.bootgrid-header .actionBar .btn-group > .btn-group .dropdown-menu .dropdown-item .dropdown-item-checkbox,
.bootgrid-footer .infoBar .btn-group > .btn-group .dropdown-menu .dropdown-item .dropdown-item-checkbox {
margin: 0 2px 4px 0;
vertical-align: middle;
}
.bootgrid-header .actionBar .btn-group > .btn-group .dropdown-menu .dropdown-item.disabled,
.bootgrid-footer .infoBar .btn-group > .btn-group .dropdown-menu .dropdown-item.disabled {
cursor: not-allowed;
}
@@ -107,11 +127,11 @@
background: #fafafa;
}
.bootgrid-table td {
overflow: hidden;
-ms-text-overflow: ellipsis;
-o-text-overflow: ellipsis;
text-overflow: ellipsis;
white-space: nowrap;
overflow: inherit !important;
-ms-text-overflow: inherit !important;
-o-text-overflow: inherit !important;
text-overflow: inherit !important;
white-space: inherit !important;
}
.bootgrid-table td.loading,
.bootgrid-table td.no-results {
18 changes: 9 additions & 9 deletions dist/jquery.bootgrid.fa.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
/*!
* jQuery Bootgrid v1.3.1 - 09/11/2015
* Copyright (c) 2014-2015 Rafael Staib (http://www.jquery-bootgrid.com)
* jQuery Bootgrid v2.0.0 - 02/22/2018
* Copyright (c) 2014-2018 Rafael Staib (http://www.jquery-bootgrid.com)
* Licensed under MIT http://www.opensource.org/licenses/MIT
*/
;(function ($, window, undefined)
{
/*jshint validthis: true */
"use strict";

$.extend($.fn.bootgrid.Constructor.defaults.css, {
icon: "icon fa",
iconColumns: "fa-th-list",
iconDown: "fa-sort-desc",
iconRefresh: "fa-refresh",
iconSearch: "fa-search",
iconUp: "fa-sort-asc"
$.extend($.fn.bootgrid.Constructor.defaults.css, {
icon: "icon fa",
iconColumns: "fa-th-list",
iconDown: "fa-caret-down",
iconRefresh: "fa-sync",
iconSearch: "fa-search",
iconUp: "fa-caret-up"
});
})(jQuery, window);
6 changes: 0 additions & 6 deletions dist/jquery.bootgrid.fa.min.js

This file was deleted.

3,810 changes: 1,942 additions & 1,868 deletions dist/jquery.bootgrid.js

Large diffs are not rendered by default.

5 changes: 0 additions & 5 deletions dist/jquery.bootgrid.min.css

This file was deleted.

6 changes: 0 additions & 6 deletions dist/jquery.bootgrid.min.js

This file was deleted.

2 changes: 2 additions & 0 deletions lib/jquery-3.3.1.min.js

Large diffs are not rendered by default.

3,138 changes: 3,138 additions & 0 deletions package-lock.json

Large diffs are not rendered by default.

14 changes: 9 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@
"name": "jquery-bootgrid",
"namespace": "jquery.bootgrid",
"title": "jQuery Bootgrid",
"version": "1.3.1",
"version": "2.0.0",
"description": "Nice, sleek and intuitive. A grid control especially designed for bootstrap.",
"homepage": "http://www.jquery-bootgrid.com",
"author": {
@@ -35,11 +35,15 @@
"Accessibility"
],
"licenses": [
{ "type": "MIT", "url": "http://www.opensource.org/licenses/MIT" }
{
"type": "MIT",
"url": "http://www.opensource.org/licenses/MIT"
}
],
"dependencies": {
"jquery": ">=1.9.0",
"bootstrap": ">=3.1.1"
"jquery": ">=3.0.0",
"bootstrap": ">=3.1.1",
"fontawesome": ">=4.7.0"
},
"devDependencies": {
"grunt": "~0.4.5",
@@ -59,4 +63,4 @@
"grunt-exec": "~0.4.5"
},
"readmeFilename": "README.md"
}
}
6 changes: 3 additions & 3 deletions src/fontawesome.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
$.extend($.fn.bootgrid.Constructor.defaults.css, {
icon: "icon fa",
iconColumns: "fa-th-list",
iconDown: "fa-sort-desc",
iconRefresh: "fa-refresh",
iconDown: "fa-caret-down",
iconRefresh: "fa-sync",
iconSearch: "fa-search",
iconUp: "fa-sort-asc"
iconUp: "fa-caret-up"
});
1,653 changes: 850 additions & 803 deletions src/internal.js

Large diffs are not rendered by default.

53 changes: 47 additions & 6 deletions src/jquery.bootgrid.less
Original file line number Diff line number Diff line change
@@ -1,4 +1,47 @@
.opacity(@opacity)
div[data-html-formatter-id], div[data-action-links-id], div[data-bootgrid-buttons-id], .customFilters
{
display: none;
}

.actionBar
{
display: flex;
flex-direction: row;
padding: 0 15px;
}

.actions {
.dropdown-menu {
li {
label {
margin: 0;
padding: 1px 10px;
width: 100%;
}
label:hover {
background: #f3f3f3;
}
}
}
}

.bootgridButtons
{
flex: 1 1 auto;
}

.bootgridSearch
{
flex: 1 1;
margin: 0 1.2em;
}

.buttonActions
{
flex: 0 1 auto;
}

.opacity(@opacity)
{
@percent: (@opacity*100);
opacity: @opacity;
@@ -32,9 +75,8 @@
.search
{
display: inline-block;
margin: 0 20px 0 0;
margin: 0;
vertical-align: middle;
width: 180px;

.glyphicon { top: 0; }
.fa { display: table-cell; }
@@ -48,13 +90,12 @@
.pagination { margin: 0 !important; }
}

.bootgrid-header .actionBar,
.bootgrid-footer .infoBar
{
text-align: right;

.btn-group > .btn-group
{
{
.dropdown-menu
{
text-align: left;
@@ -129,7 +170,7 @@

td
{
.turncate();
.noTurncate();

&.loading, &.no-results
{
1,529 changes: 778 additions & 751 deletions src/public.js

Large diffs are not rendered by default.