FullTextFilter 组件
FullTextFilter 组件在功能上与 propertyFilter 属性过滤器 组件类似,但是 FullTextFilter 在所有实体字段索引中进行全文搜索。
XML 元素 |
|
|---|---|
Java 类 |
|
XML 属性 |
id - alignSelf - ariaLabel - ariaLabelledBy - autoApply - classNames - colspan - css - dataLoader - defaultValue - enabled - errorMessage - focusShortcut - height - helperText - justifySelf - label - labelPosition - labelVisible - labelWidth - maxHeight - maxWidth - minHeight - minWidth - parameterName - readOnly - required - requiredMessage - searchStrategy - tabIndex - themeNames - visible - width |
事件和处理器 |
AttachEvent - BlurEvent - ComponentValueChangeEvent - DetachEvent - FocusEvent - validator |
XML 内部元素 |
基本用法
使用 Studio 将该组件添加至视图。
在操作面板点击 Add Component,找到 Full-text filter 并双击。
由于 dataLoader 是必需属性。Studio 会电视一个对话框用于选择数据加载器。选择所需的数据加载器并点击 OK。
<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>
如果不使用视图设计器,可以手动在视图 XML 中声明 search 命名空间:
<view xmlns="http://jmix.io/schema/flowui/view"
xmlns:search="http://jmix.io/schema/search/ui"
title="msg://searchView.title">
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 |