Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/michaelsogos/bootstrap-table-toolbar-buttons

Extension for bootstrap-table to add custom buttons to toolbar
https://github.com/michaelsogos/bootstrap-table-toolbar-buttons

Last synced: 5 days ago
JSON representation

Extension for bootstrap-table to add custom buttons to toolbar

Awesome Lists containing this project

README

        

Custom Toolbar Buttons
=======================

This is an extension of [Bootstrap table](http://bootstrap-table.wenzhixin.net.cn/) to add custom buttons to toolbar, close to default buttons like "refresh", "column selector", etc.

Features
-----
- Add a custom button with specified icon that on click event call a custom function

Demo
-----
See it in action: [demo here](https://jsfiddle.net/michaelsogos/w112m1o3/)

Installation
-----
#### Bower

```
bower install bootstrap-table-toolbar-buttons
```

Usage
-----
Include this extension after [Bootstrap-table](https://github.com/wenzhixin/bootstrap-table).
In case you use an AMD loader (like require.js) specify manually dependecies to jQuery, bootstrap and bootstrap-table (like shims in require.js).

```html

```

Simple example:
```html






Item ID
Name
Price



1ABC$1.00
2DEF$2.00
3GHI$3.00
4XYZ$4.00







$(function() {
$('#grid').bootstrapTable({
showRefresh: true,
customToolbarButtons: [
{
name: "grid-filters",
title: "Filters",
icon: "glyphicon-filter",
callback: onShowFiltersDialog
}
]
});
});

var onShowFiltersDialog = function(){
$('#filters-dialog').modal('show');
}

```

Options
-----

|Name |Type |Default |Description|
|------------------------|---------------------|----------|-----------|
|customToolbarButtons |Array |[] |An array of button object (see below).|

Button object
----

|Name |Type |Default |Description|
|------------------------|---------------------|----------|-----------|
|name |String |undefined |The attribute NAME of the button. It must be unique else just one button will be rendered.|
|title |String |undefined |The attribute TITLE and ARIA-LABEL of the button.|
|icon |String |undefined |The css class name of the button (usually a glyphicon), it depend on the option *iconsPrefix*.|
|callback |Function |undefined |The function will be called when user raise CLICK event to the button.|