ListToolBar · Search, filters and table settings
数据展示组件。公开入口:ListToolBar、TableDropdown。
在线演示
本页复用官方 Go gallery 的真实示例。下方可以切换场景、主题和深浅色;长页面支持滚动,复杂布局可以横向滚动或在独立页面打开。
示例代码
以下是上方在线演示运行的 Go 源码(来自官方 gallery),点击标题展开。函数接收的 c *ui.Context 由窗口的 UI 循环每帧传入,接入方式见 Go GUI 入门。
ListToolBar · Search, filters and table settings
gallery 演示 ListToolBar 的 Render 函数,源码 page_b4d.go#L52。
加载中…
API
签名与说明由 site/tools/compdoc 从 Go 源码和文档注释提取;点击名称跳到 Go API 参考 的对应条目。
入口函数
ui.ListToolBar
func ListToolBar(c *Context) *ListToolBarWListToolBar starts a list toolbar; chain options, then Show. ConfigProvider.Defaults keys: "title", "subTitle", "tooltip" (strings), "search" (bool, default false), "multipleLine" (bool, default false).
返回 *ListToolBarW,可链式调用的方法见 ListToolBarW 方法。
ui.TableDropdown
func TableDropdown(c *Context, items []MenuItem) *TableDropdownWTableDropdown starts a table-row action menu. Show uses an ellipsis trigger with a localized accessible name. Button selects the ordinary button variant (not a split button). ConfigProvider.Defaults keys: "disabled" (false), "trigger" (TriggerHover), "placement" (BottomStart).
返回 *TableDropdownW,可链式调用的方法见 TableDropdownW 方法。
ListToolBarW 方法
ui.ListToolBarW:ListToolBarW composes the title, subtitle, tooltip, search, actions, settings, filter, tabs and header menu of a list. ProTable uses this same public component for its toolbar, passing its existing settings.
| 方法 | 说明 | 签名 |
|---|---|---|
Actions | Actions builds the right-hand actions. | Actions(fn func()) *ListToolBarW |
Filter | Filter builds the filter area (for example LightFilter). | Filter(fn func()) *ListToolBarW |
ID | ID returns the toolbar ID after Show. | ID() ID |
Menu | Menu sets the header menu, replacing the heading; kind is "inline" (default), "tab" or "dropdown". | Menu(kind string, active *string, items []TabItem) *ListToolBarW |
MultipleLine | MultipleLine places filters and tabs on a separate line. | MultipleLine(on bool) *ListToolBarW |
OnSearch | OnSearch receives a submitted keyword (Enter or search button). | OnSearch(fn func(string)) *ListToolBarW |
Search | Search binds the search input; nil hides it. | Search(s *string) *ListToolBarW |
Settings | Settings builds the right-hand settings (use named IconButtons). | Settings(fn func()) *ListToolBarW |
Show | Show builds the toolbar. | Show() *ListToolBarW |
SubTitle | SubTitle sets the secondary text next to the heading. | SubTitle(s string) *ListToolBarW |
Tabs | Tabs sets the second-line tabs, shown only with MultipleLine(true). | Tabs(active *string, items []TabItem) *ListToolBarW |
Title | Title sets the heading. | Title(s string) *ListToolBarW |
Tooltip | Tooltip sets the heading information tooltip. | Tooltip(s string) *ListToolBarW |
TableDropdownW 方法
ui.TableDropdownW:TableDropdownW is a row-action dropdown backed by DropdownW. Menu keys, disabled items, focus navigation and dismissal use the same menu model.
| 方法 | 说明 | 签名 |
|---|---|---|
Button | Button uses an ordinary button with a down arrow, as TableDropdown.Button. | Button(label string) *TableDropdownW |
Clicked | Clicked returns the menu key selected this frame, or an empty string. | Clicked() string |
Disabled | Disabled disables the trigger and menu. | Disabled(on bool) *TableDropdownW |
ID | ID returns the trigger wrapper ID after Show. | ID() ID |
IsOpen | IsOpen reports whether the menu is expanded. | IsOpen() bool |
Label | Label replaces the ellipsis with text. | Label(s string) *TableDropdownW |
OnSelect | OnSelect receives the selected menu key. | OnSelect(fn func(string)) *TableDropdownW |
Open | Open binds the expanded state. | Open(on *bool) *TableDropdownW |
Show | Show builds the trigger and menu. | Show() *TableDropdownW |
Trigger | Trigger chooses hover, click or context menu activation. | Trigger(t Trigger) *TableDropdownW |
MenuItem 参数类型
ui.MenuItem:MenuItem is an entry of Menu / Dropdown.
| 字段 | 说明 | 类型 |
|---|---|---|
Key | string | |
Label | string | |
Icon | *icon.Icon | |
Children | []MenuItem | |
Disabled | bool | |
Danger | bool | |
Divider | render a separator instead of an item | bool |
Group | Group makes the entry a titled group of Children (Ant type="group", Element el-menu-item-group): Label is a non-clickable title and the children follow at the same level. | bool |
Shortcut | Shortcut is the item's keyboard shortcut text ("Ctrl+C", "⌘K"), shown in a dimmer column at the item's inline end of Dropdown panels, Menu pop-out submenus and ContextMenuAt. | string |
Radio | Radio marks a point context-menu leaf as a single-choice item. | *bool |
相关链接
本页由完整组件表、实际 gallery 注册信息和 Go 源码(site/tools/compdoc)生成;新增组件未接入演示时,文档构建会报错。场景中的表单、表格、图表和移动端屏幕使用示例数据。