FullTextFilter 全文搜索过滤器
|
This component requires the free Search add-on. |
FullTextFilter 组件在功能上与 propertyFilter 属性过滤器 组件类似,但是在所有实体字段索引中进行全文搜索。
XML 元素 |
|
|---|---|
Java 类 |
|
基本用法
在视图 XML 中声明 search 命名空间:
<view xmlns="http://jmix.io/schema/flowui/view"
xmlns:search="http://jmix.io/schema/search/ui"
title="msg://searchView.title">
|
当使用顶部操作面板中的 Add Component 操作添加组件时,Studio 会自动添加该命名空间。请参见 组件面板。 |
通过 dataLoader 属性将 fullTextFilter 与集合数据加载器进行绑定。下面的示例中,声明了数据、过滤器和结果表格:
<data>
<collection id="ordersDc"
class="com.company.demo.entity.Order">
<loader id="ordersDl"
readOnly="true">
<query>
<![CDATA[select e from Order_ e]]>
</query>
</loader>
<fetchPlan extends="_base">
<property name="customer"
fetchPlan="_base"/>
</fetchPlan>
</collection>
</data>
<facets>
<dataLoadCoordinator auto="true"/>
</facets>
<layout>
<search:fullTextFilter dataLoader="ordersDl"
autoApply="true"/>
<dataGrid id="ordersDataGrid"
width="100%"
dataContainer="ordersDc">
<columns>
<column property="number"/>
<column property="date"/>
<column property="amount"/>
<column property="product"/>
<column property="customer"/>
</columns>
</dataGrid>
</layout>
FullTextFilter 组件的操作方式如下:
-
执行全文搜索以查找与搜索条件匹配的实体标识符。
-
将包含这些标识符的条件附加到关联的
dataLoader上。 -
当
DataGrid(或其他列表组件)与此数据加载器关联时,仅显示与全文搜索条件匹配的那些记录。
全文条件还可以与数据加载器的其他过滤器结合使用,提供更精细的结果集。
验证
如需检查 fullTextFilter 组件输入的值,可以在内部元素 validators 中添加一个 validator。
fullTextFilter 可以使用下列预定义的验证器:
XML 元素 |
|
|---|---|
预定义验证器 |
custom - decimalMax - decimalMin - digits - doubleMax - doubleMin - email - future - futureOrPresent - max - min - negative - negativeOrZero - notBlank - notEmpty - notNull - past - pastOrPresent - positive - positiveOrZero - regexp - size |
XML 属性
下面是 fullTextFilter 的特殊属性:
| 名称 | 描述 | 默认值 |
|---|---|---|
设置为 |
||
必需属性。设置当前 |
- |
|
Sets the position of the label relative to the filter value component. See propertyFilter label position. |
— |
|
Sets the label width as a CSS length. See propertyFilter label width. |
— |
|
设置搜索策略。参考 搜索策略。 |
下面是 fullTextFilter 支持的其他通用属性:
id - alignSelf - ariaLabel - ariaLabelledBy - classNames - colspan - css - defaultValue - enabled - errorMessage - focusShortcut - height - helperText - justifySelf - label - labelVisible - maxHeight - maxWidth - minHeight - minWidth - parameterName - readOnly - required - requiredMessage - tabIndex - themeNames - visible - width