如何使用分页使过滤器成为可能



TYPO3 9如何设置小部件的过滤器。页面?示例:

<f:form name="filter" controller="myController" pluginName="Plugin" action="list" method="POST">
<f:if condition="{types}">
<f:for each="{types}" as="type">
<f:form.checkbox name="filter[types][]" value="{type.uid}" />
</f:for>
</f:if>
...
<f:widget.paginate objects="{myObject}" as="Objects" configuration="{itemsPerPage: 20, insertAbove: 1, insertBelow: 1, maximumNumberOfLinks: 10, addQueryString: 1, addQueryStringMethod: 'POST'}">...

但这只适用于第一页——第二页失去了参数。

下一个问题:如何为分页设置nextPageLink(ajax(?f: widget.link不工作:https://forge.typo3.org/issues/89522谢谢:(

最后,我找到了两个解决方案:

类型脚本:

plugin.tx_yourext_plugin.features.requireCHashArgumentForActionArguments = 0

控制器:(通过methods参数或$this->请求轻松访问(

public function listAction (int $ argument = 0) {...

ext_localconf.php

$GLOBALS['TYPO3_CONF_VARS']['FE']['cacheHash']['excludedParameters'][] = 'tx_yourext_plugin[argument]';

控制器:

public function listAction() {
$argument = $this->request->getArgument('argument');



流体/HTML:

解决方案1:自己的普通HTML表单(没有FLUID/ViewHelper(:

<form action = '<f:uri.action action = "cunning" controller = "job"/>' method = "GET">
<select name = "tx_yourext_plugin [argument]">...

解决方案2:拥有具有以下内容的ViewHelper-然后他可以被用作原件(他只防止生产自动生成__引用人隐藏字段以及可信属性的隐藏字段(:

class FormViewHelper extends TYPO3CMSFluidViewHelpersFormViewHelper {
protected function renderHiddenReferrerFields () {
return ";
}
protected function renderTrustedPropertiesField () {
return ";
}
}

非常感谢https://www.ophidia.net/fluid-fform-referrer-deaktivieren/




对于两种解决方案:液体繁殖:(注:自TYPO3 10起,添加QueryStringMethod:'POST'(

<f:widget.paginate... configuration = "{... addQueryString: 'true', addQueryStringMethod: 'GET'}">



但我还有一个问题——我没有得到过滤器表单的漂亮URL。因此,如果我发送表单,url就不好了——但如果我在那之后使用分页,那么url就很好,很干净。

有人有主意吗?

MyPlugin:
type: Extbase
extension: MyExtKeyNameSpace
plugin: PluginName
defaultController: 'Controller::list'
routes:
# - { routePath: '/{page-label}-{page}', _controller: 'Controller::list', _arguments: {'page': '@widget_0/currentPage'} }
# - { routePath: '/{type-label}-{type}', _controller: 'Controller::list', _arguments: {'type': 'pluginTypes'} }
# - { routePath: '/{area-label}-{area}', _controller: 'Controller::list', _arguments: {'area': 'pluginAreas'} }
# - { routePath: '/type-{type}/area-{area}', _controller: 'Controller::list', _arguments: {'type': 'pluginTypes', 'area': 'pluginAreas'} }
- { routePath: '/{page-label}{page}/{type-label}{type}/{area-label}{area}', _controller: 'Controller::list', _arguments: {'page': '@widget_0/currentPage', 'type': 'pluginTypes', 'area': 'pluginAreas'} }
- { routePath: '/{company_slug}/{plugin_slug}', _controller: 'Controller::show', _arguments: {'company_slug': 'company', 'plugin_slug': 'plugin'} }
defaults:
page: ''
type: ''
area: ''
requirements:
page: 'd+'
type: 'd+'
area: 'd+'
aspects:
page: { type: StaticRangeMapper, start: '1', end: '100' }
page-label: { type: LocaleModifier, default: 'page-', localeMap: [{ locale: 'en_.*', value: 'page-' }, { locale: 'de_.*', value: 'seite-' }] }
company_slug: { type: 'PersistedAliasMapper', tableName: 'tt_address', routeFieldName: 'slug' }
plugin_slug: { type: 'PersistedAliasMapper', tableName: 'tx_myextkey_domain_model_plugin', routeFieldName: 'slug' }
type-label: { type: LocaleModifier, default: 'type-', localeMap: [] }
area-label: { type: LocaleModifier, default: 'area-', localeMap: [] }

最新更新