简体   繁体   English

searchkit-不持续状态的RefinementListFilter复选框

[英]searchkit - RefinementListFilter Checkboxes Not Persisting State

I have a question about the RefinementListFilter in searchkit. 我对searchkit中的RefinementListFilter有疑问。 I have a few filters that are booleans, for example: {field: 'hasChildren': {'1' : 'Yes', '0': 'No'}} to give an example of the translation for that field. 我有一些布尔值的过滤器,例如: {field: 'hasChildren': {'1' : 'Yes', '0': 'No'}}给出该字段的翻译示例。 For some reason, I can persist the correct selected filters after a page refresh in the url, and in the SelectedFilters/GroupSelectedFilters, but the actual checkboxes in the RefinementListFilter are not checked after you refresh the view. 出于某种原因,页面刷新后可以在url和SelectedFilters / GroupSelectedFilters中保留正确的选定过滤器,但是刷新视图后,不会选中RefinementListFilter中的实际复选框。 An example of the url query string: &hasChildren[0]=1 , where hasChildren is true. 网址查询字符串的示例: &hasChildren[0]=1 ,其中hasChildren为true。 Do you have an idea why the checkboxes arent reflecting the state of the query correctly? 您是否知道为什么复选框不能正确反映查询状态? I can provide more info if you need. 如果您需要,我可以提供更多信息。 Thank you! 谢谢!

PS: My ES mappings has that hasChildren field as a type boolean if that helps any. PS:我的ES映射将hasChildren字段设置为布尔类型(如果有帮助的话)。

I also have a boolean field but it's working perfectly with RefinementListFilter . 我也有一个boolean字段,但它与RefinementListFilter完美配合。 The value is true or false . 该值为truefalse I just need to add 我只需要添加

Boolean(fields={'raw': Keyword()}) 

on my mapping, then call it on field part RefinementListFilter as item.raw . 在我的映射上,然后在字段部分RefinementListFilter item.raw其称为item.raw

I'm a little confused by the question.. Hope this solves your problem. 这个问题让我有些困惑。希望这能解决您的问题。 Cheers! 干杯!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM