Skip to content

ListToolBar · Search, filters and table settings ​

数据展示组件。公开入口:ListToolBar、TableDropdown。

在线演示 ​

本页复用官方 Go gallery 的真实示例。下方可以切换场景、主题和深浅色;长页面支持滚动,复杂布局可以横向滚动或在独立页面打开。

ListToolBar · Search, filters and table settings · 在线体验真实 Go 组件
在独立页面打开 ↗

查看此场景的 Go 源码 ↗

示例代码 ​

以下是上方在线演示运行的 Go 源码(来自官方 gallery),点击标题展开。函数接收的 c *ui.Context 由窗口的 UI 循环每帧传入,接入方式见 Go GUI 入门。

ListToolBar · Search, filters and table settings

gallery 演示 ListToolBar 的 Render 函数,源码 page_b4d.go#L52。

加载中…

TableDropdown · Row actions

gallery 演示 TableDropdown 的 Render 函数,源码 page_b4d.go#L40。

加载中…

API ​

签名与说明由 site/tools/compdoc 从 Go 源码和文档注释提取;点击名称跳到 Go API 参考 的对应条目。

入口函数 ​

ui.ListToolBar ​

go
func ListToolBar(c *Context) *ListToolBarW

ListToolBar 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 ​

go
func TableDropdown(c *Context, items []MenuItem) *TableDropdownW

TableDropdown 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.

方法说明签名
ActionsActions builds the right-hand actions.Actions(fn func()) *ListToolBarW
FilterFilter builds the filter area (for example LightFilter).Filter(fn func()) *ListToolBarW
IDID returns the toolbar ID after Show.ID() ID
MenuMenu sets the header menu, replacing the heading; kind is "inline" (default), "tab" or "dropdown".Menu(kind string, active *string, items []TabItem) *ListToolBarW
MultipleLineMultipleLine places filters and tabs on a separate line.MultipleLine(on bool) *ListToolBarW
OnSearchOnSearch receives a submitted keyword (Enter or search button).OnSearch(fn func(string)) *ListToolBarW
SearchSearch binds the search input; nil hides it.Search(s *string) *ListToolBarW
SettingsSettings builds the right-hand settings (use named IconButtons).Settings(fn func()) *ListToolBarW
ShowShow builds the toolbar.Show() *ListToolBarW
SubTitleSubTitle sets the secondary text next to the heading.SubTitle(s string) *ListToolBarW
TabsTabs sets the second-line tabs, shown only with MultipleLine(true).Tabs(active *string, items []TabItem) *ListToolBarW
TitleTitle sets the heading.Title(s string) *ListToolBarW
TooltipTooltip 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.

方法说明签名
ButtonButton uses an ordinary button with a down arrow, as TableDropdown.Button.Button(label string) *TableDropdownW
ClickedClicked returns the menu key selected this frame, or an empty string.Clicked() string
DisabledDisabled disables the trigger and menu.Disabled(on bool) *TableDropdownW
IDID returns the trigger wrapper ID after Show.ID() ID
IsOpenIsOpen reports whether the menu is expanded.IsOpen() bool
LabelLabel replaces the ellipsis with text.Label(s string) *TableDropdownW
OnSelectOnSelect receives the selected menu key.OnSelect(fn func(string)) *TableDropdownW
OpenOpen binds the expanded state.Open(on *bool) *TableDropdownW
ShowShow builds the trigger and menu.Show() *TableDropdownW
TriggerTrigger chooses hover, click or context menu activation.Trigger(t Trigger) *TableDropdownW

MenuItem 参数类型 ​

ui.MenuItem:MenuItem is an entry of Menu / Dropdown.

字段说明类型
Keystring
Labelstring
Icon*icon.Icon
Children[]MenuItem
Disabledbool
Dangerbool
Dividerrender a separator instead of an itembool
GroupGroup 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
ShortcutShortcut 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
RadioRadio marks a point context-menu leaf as a single-choice item.*bool

相关链接 ​

本页由完整组件表、实际 gallery 注册信息和 Go 源码(site/tools/compdoc)生成;新增组件未接入演示时,文档构建会报错。场景中的表单、表格、图表和移动端屏幕使用示例数据。

以 MIT 许可发布