Download the PHP package hello-sebastian/hello-bootstrap-table-bundle without Composer

On this page you can find all versions of the php package hello-sebastian/hello-bootstrap-table-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package hello-bootstrap-table-bundle

HelloBootstrapTableBundle

This Bundle provides simple bootstrap-table configuration for your Doctrine Entities.

Used bootstrap-table version 1.18.3.

Inspired by SgDatatablesBundle and omines/datatables-bundle

Overview

  1. Features
  2. Installation
  3. Your First Table
  4. Columns
    1. TextColumn
    2. BooleanColumn
    3. DateTimeColumn
    4. HiddenColumn
    5. LinkColumn
    6. CountColumn
    7. ActionColumn
  5. Filters
    1. TextFilter
    2. ChoiceFilter
    3. BooleanChoiceFilter
    4. CountFilter
  6. Configuration
    1. Table Dataset Options
    2. Table Options
  7. Common Use-Cases
    1. Custom Doctrine Queries
    2. Detail View
    3. Use Icons as action buttons
  8. Contributing

Features


Installation

Step 1: Download the Bundle

Open a command console, enter your project directory and execute the following command to download this bundle:

Step 2: Enable the Bundle (without flex)

Then, enable the bundle by adding it to the list of registered bundles in the config/bundles.php file of your project:

Step 3: Assetic Configuration

Install the web assets

Add Assets into your base.html.twig

CSS:

JavaScript:


Your First Table

Step 1: Create a Table class

Step 2: In the Controller

Step 3: Add table in Template

The Twig function will render a table with all attributes configured.


Columns

TextColumn

Represents column with text. With formatter you can create complex columns.

Options from bootstrap-table

The following options were taken from bootstrap-table. For more information about the options, see the bootstrap-table documentation: https://bootstrap-table.com/docs/api/column-options/

Option Type Default Description
title string / null null Set column title. If no value is set, the specified attribute name is taken.
field string / null null Set internal field name for bootstrap-table. If no value is set, the specified attribute name is taken.
width integer / null null column width in px
widthUnit string "px" Unit of width.
class string / null null The column class name.
formatter string / null null JavaScript function name for formatter. (see formatter)
footerFormatter string / null null JavaScript function name for footer formatter.
searchable bool true enable / disable filtering for this column
sortable bool true enable / disable sortable for this column
switchable bool true enable / disable interactive hide and show of column.
visible bool true show / hide column
align string / null null Indicate how to align the column data. 'left', 'right', 'center' can be used.
halign string / null null Indicate how to align the table header. 'left', 'right', 'center' can be used.
valign string / null null Indicate how to align the cell data. 'top', 'middle', 'bottom' can be used.
falign string / null null Indicate how to align the table footer. 'left', 'right', 'center' can be used.
filterControl string "input" render text field in column header (input, select, datepicker)
filterData string / null null Set custom select filter values. If filterOption is set to select, configured selection options are set automatically.
titleTooltip string / null null add tooltip to header

Options from HelloBootstrapTable

The following options are not included in bootstrap-table. They were added separately.

Option Type Default Description
emptyData string "" default value if attribute from entity is null
filter array [TextFilter::class, array()] Set filter to column (see Filters)
addIf Closure function() {return true;} In this callback it is decided if the column will be rendered.
data Closure / null null custom data callback (see example)
sort Closure / null null custom sort query callback (see example)
search Closure / null null custom search query callback (see example)

Example

search Option:

Paramenter name Description
Composite $composite In the global search all columns are connected as or. In the advanced search all columns are combined with an and-connection. With $composite more parts can be added to the query. Composite is the parent class of AndX and OrX.
QueryBuilder $qb $qb holds the use QueryBuilder. It is the same instance as can be queried with getQueryBuilder() in the table class.
$search The search in the type of a string.

BooleanColumn

Represents column with boolean values.

Options

All options of TextColumn.

advancedSearchType is set to checkbox by default.

filter is set to array(BooelanChoiceFilter::class, array()) by default.

And:

Option Type Default Description
allLabel string "All" label for "null" values
trueLabel string "True" label for true values
falseLabel string "False" label for false values

Example


DateTimeColumn

Represents column with DateType values.

Options

All Options of TextColumn

And:

Option Type Default Description
format string "Y-m-d H:i:s" DateTime format string

Example


HiddenColumn

Represents column that are not visible in the table. Can used for data which are required for other columns.

Options

All Options of TextColumn.

searchable, sortable, visible and switchable are disabled by default.

Example


LinkColumn

Represents column with a link.

Options

All Options of TextColumn.

formatter is set to defaultLinkFormatter.

And:

Option Type Default Description
routeName string null Route name. This option is required.
routeParams array [] Array of route parameters. The key is the parameter of the route. The value is the property path.
attr array [ ] Array of any number of attributes formatted as HTML attributes. The array ["class" => "btn btn-success"] is formatted as class="btn btn-success".

Example

If the route parameters cannot be determined automatically based on the entity, user-defined routes can be created by overwriting data. Once data is overwritten, routeName and routeParams are no longer necessary to specify.


CountColumn

Represents column for counting OneToMany relations (for ArrayCollection attributes).

Only works with direct attributes so far. For example, "users" would work in a DepartmentTable, but "users.items" would not.

Options

All Options of TextColumn.

filter is set to array(CountFilter::class, array()) by default.

Example


ActionColumn

Represents column for action buttons (show / edit / remove ...).

Options

All Options of TextColumn

sortable, searchable and switchable are disable by default.

formatter is set to defaultActionFormatter.

And:

Option Type Default Description
buttons array [ ] array of buttons configuration as array.

Example

ActionButtons

Option Type Default Description
displayName string "" label of button
routeName string "" route name
routeParams array ["id"] Array of property value names for the route parameters. By default is id set.
classNames string "" CSS class names which added directly to the a element. Overrides default class names from YAML config.
additionalClassNames string "" You can set default class names in YAML config. Then you can add additional class names to the button without override the default config.
attr array [ ] Array of any number of attributes formatted as HTML attributes. The array ["title" => "Show"] is formatted as title="Show". The href and class attributes are created by the other options and should not be defined here.
addIf Closure function($entity) {return true;} In this callback it is decided if the button will be rendered.

YAML Example

YAML config options are set to all buttons. If you want override global options from YAML config use classNames option.


Filters

Filters can be used to generate predefined queries. In addition, different input fields for the filters are displayed (currently only under the Advanced Search).


TextFilter

With the TextFilter you can filter by text within the column. TextFilter is set by default to all columns.

Options

Option Type Default Description
advSearchFieldFormatter string "defaultAdvSearchTextField" Set JavaScript function name to format input field.
placeholder string / null title option from column with " ..." Set HTML placeholder for input field.

If you want to change advSearchFieldFormatter, you also need to create a JavaScript function with the same name in the window scope. As an example here is the default function:

Example


ChoiceFilter

With the ChoiceFilter you can create a select input field.

Options

All Options from TextFilter.

And:

Option Type Default Description
choices array [ ] Key - Values pair of choices. Key: value attribute of select field; Value: display name of options in select field.
selectedValue string | int "null" Default selected value when table is rendered.

Example


BooleanChoiceFilter

BooleanChoiceFilter is a special ChoiceFilter with default choices and query expression. The expression is optimized for boolean values.

Options

All Options from ChoiceFilter.

If you use BooleanChoiceFilter inside a BooleanColumn, the allLabel, trueLabel and falseLabel options from BooleanColumn are taken for null, true and false for the choices option by default.

If not choices is set to:

Example


CountFilter

With the CountFilter you can filtering and sorting by counting OneToMany relations.

Options

All Options from TextFilter.

And:

Option Type Default Description
condition string "gte" Operation to compare counting.
Available options: "gt", "gte", "eq", "neq", "lt", "lte"
primaryKey string "id" Primary key of the target entity in the OneToMany relation.
For example: A user is in one deparment. One department has many users. In the user entity there is a $department attribute that is pointing to the department entity. With this option you specify the primary key of the department entity (the target entity).

Example


Configuration

Table Dataset Options

Table Dataset are provided directly to the bootstrap-table as data-attributes and are a collection of setting options for the table. For more information check bootstrap-table documentation: https://bootstrap-table.com/docs/api/table-options/

Options

Option Type Default
pagination bool true
search bool true
show-columns bool true
show-columns-toggle-all bool false
show-footer bool true
filter-control bool true
show-refresh bool true
toolbar string "#toolbar"
page-list string "[10, 25, 50, 100, 200, 500, All]"
page-size int 25
sort-reset bool true
pagination-V-Align string "both"
undefined-text string ""
locale string "en-US"
advanced-search bool false
id-table string class name of table. ($this->getTableName())
icons-prefix string "fa"
icons array see under table*
click-to-select bool true
show-jump-to bool true
show-export bool true
export-types string "['csv', 'txt'', 'excel']"
export-options array see under table*
detail-view bool false
detail-formatter string ""
detail-view-align string ""
detail-view-icon bool true
detail-view-by-click bool false
sticky-header bool true
sticky-header-offset-left int 0
sticky-header-offset-right int 0
sticky-header-offset-y int 0
checkbox-header bool true
escape bool false
height int / null null
multiple-select-row bool false
sort-name string / null null
sort-order string / null null

icons:

Option Type Default
advancedSearchIcon string "fa-filter"
paginationSwitchDown string "fa-caret-square-o-down"
paginationSwitchUp string "fa-caret-square-o-up"
columns string "fa-columns"
refresh string "fa-sync"
export string "fa-download"
detailOpen string "fa-plus"
detailClose string "fa-minus"
toggleOff string "fa-toggle-off"
toggleOn string "fa-toggle-on"
fullscreen string "fa-arrows-alt"
search string "fa-search"
clearSearch string "fa-trash"

export-options:

Examples

Inside from Table class:

Outside from Table class:

YAML config:

YAML config options are set to all tables. If you want override global options from YAML config use setTableDataset method in or outside from HelloBootstrapTable.


Table Options

All options that should not be provided directly as data-attributes of the table are managed here.

Options

Option Type Default
tableClassNames string "table table-stripped table-sm"
enableCheckbox bool false
bulkIdentifier string "id"
bulkUrl string ""
bulkActionSelectClassNames string "form-control"
bulkActions array [ ]
bulkButtonName string "Okay"
bulkButtonClassNames string "btn btn-primary"
enableTotalCountCache bool false

Examples

Inside from Table class:

Outside from Table class:

YAML config:

YAML config options are set to all tables. If you want override global options from YAML config use setTableDataset method in or outside from HelloBootstrapTable.


Common Use-Cases

Custom Doctrine Queries

Sometimes you don't want to display all the data in a database table. For this you can "prefilter" the Doctrine query.

Example


Default table sorting

bootstrap-table allows you to specify a default sort order. For this purpose there are two options "sort-name" and "sort-order". These can be set by the setTableDataset method. "sort-name" expects the dql (or if set field name) of the column. "sort-order" can be set by "asc" or "desc".

HelloBootstrapTable provides a helper method setDefaultSorting to set the default sort order.


Detail View

You can expand rows in bootstrap-table. This option is called "detail view" and can be enabled in the datasets (by default this is disabled). For displaying the content of detail-view a formatter is needed (also to be specified in datasets). In the formatter you have access to the data of the table row. For complex representations Twig can also be used. See the example below.

To display detailView as content of the expanded table row a formatter function must be created and detailView must be returned. Remember to create the formatter before calling {{ hello_bootstrap_table_js() }}.

Alternative you can of course create your HTML with JavaScript inside the formatter.


Use Icons as action buttons

To save space in the table, it makes sense to use icons instead of written out buttons. This is easily possible by using HTML instead of a word in the displayName option of the action buttons.


Contributing

Contributions are welcome and will be credited.


All versions of hello-bootstrap-table-bundle with dependencies

PHP Build Version
Package Version
Requires php Version >=7.2.5
ext-json Version *
doctrine/common Version ^2.6|^3.0
doctrine/orm Version ^2.6.3
sensio/framework-extra-bundle Version ^5.1|^6.1
symfony/property-access Version ^4.4|^5.0|^6.0
symfony/security-bundle Version ^4.4|^5.0|^6.0
symfony/twig-bundle Version ^4.4|^5.0|^6.0
symfony/options-resolver Version ^4.4|^5.0|^6.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package hello-sebastian/hello-bootstrap-table-bundle contains the following files

Loading the files please wait ....