View on GitHub

自定义视图

Bootstrap Table 的自定义视图扩展。

Description

此扩展添加了创建自定义视图以显示数据的功能。

Usage

<script src="extensions/custom-view/bootstrap-table-custom-view.js"></script>

Example

自定义视图

Options

customView

  • Attribute: data-custom-view

  • Type: Function|Boolean

  • Detail:

    设置为 false 以禁用此扩展。 设置为 function 以格式化您的自定义视图。

  • Default: false

customViewDefaultView

  • Attribute: data-custom-view-default-view

  • Type: Boolean

  • Detail:

    设置为 true 以将自定义视图显示为默认视图。

  • Default: false

showCustomView

  • Attribute: data-show-custom-view

  • Type: Boolean

  • Detail:

    设置为 true 以显示自定义视图切换按钮。

  • Default: false

Icons

  • customViewOn:
    • Bootstrap3: glyphicon glyphicon-list
    • Bootstrap4: fa fa-eye
    • bootstrap5: ‘bi-eye’,
    • Semantic: fa fa-eye
    • Foundation: fa fa-eye
    • Bulma: fa fa-eye
    • Materialize: remove_red_eye
  • customViewOff:
    • Bootstrap3: glyphicon glyphicon-thumbnails
    • Bootstrap4: fa fa-th
    • bootstrap5: ‘bi-grid’,
    • Semantic: fa fa-th
    • Foundation: fa fa-th
    • Bulma: fa fa-th
    • Materialize: grid_on

Methods

toggleCustomView

  • 在表格和自定义视图之间切换视图。

Events

onCustomViewPreBody

  • jQuery Event: custom-view-pre-body.bs.table

  • Parameter: undefined

  • Detail:

    在渲染自定义视图之前触发。

onCustomViewPostBody

  • jQuery Event: custom-view-post-body.bs.table

  • Parameter: undefined

  • Detail:

    在渲染自定义视图之后触发。

onToggleCustomView

  • 当自定义视图切换时触发。

  • jQuery Event: toggle-custom-view.bs.table

  • Parameter: state

  • Detail:

    当自定义视图切换时触发:

    • state:新的自定义视图状态(true -> 启用自定义视图,false -> 禁用自定义视图)

Localizations

formatToggleCustomViewOn

  • type: Function

  • Default: function () { return "显示自定义视图" }

formatToggleCustomViewOff

  • type: Function

  • Default: function () { return "隐藏自定义视图" }