将 calendar_date_select 链接到 ActiveScaffold 中的选择
我正在尝试将 calendaer_date_select 链接到选择字段,以便选择列表按所选日期进行过滤。 描述的说明进行操作
我已按照这里我在activescaffold配置中 :
config.columns[:order_date].form_ui = :calendar_date_select
config.columns[:order_date].options = {:update_column => :sale}
config.columns[:sale].form_ui = :select
...在助手中:
def options_for_association_conditions(association)
if association.name == :sale
{'sales.order_date' => @record.order_date}
else
super
end
end
问题是从 javascript 小部件中选择日期 不会触发选择刷新。但是如果我输入日期 然后就可以了。有什么想法吗?
I am trying to chain a calendaer_date_select to a select field, so the select list is filtered by the choosen date. I have followed the instructions as described here
I have in the activescaffold config:
config.columns[:order_date].form_ui = :calendar_date_select
config.columns[:order_date].options = {:update_column => :sale}
config.columns[:sale].form_ui = :select
... and in the helper:
def options_for_association_conditions(association)
if association.name == :sale
{'sales.order_date' => @record.order_date}
else
super
end
end
The problem is that picking a date from the javascript widget thingy
doesn't trigger the select to refresh. However if I type in the date
then it does. Any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是 ActiveScaffold 的一个错误,已于今天早上修复。因此,再次克隆存储库将解决您的问题。
根据记录,ActiveScaffold 用于监视更改的方法无法捕捉日历日期选择设置字段的方式。 ActiveScaffold 监视字段上的更改事件以进行列更新。更改事件是由字段值在获得焦点和失去焦点之间的修改触发的。日历日期选择会修改值,而不给予或删除该字段的焦点。
如果您不想更新插件,您可以通过执行以下操作自行将其组合在一起
:
This was a bug with ActiveScaffold that was fixed this morning. So cloning the repository again will solve your problems.
For the record, the method ActiveScaffold uses to watch for changes doesn't catch the way that Calendar Date Select sets the field. ActiveScaffold watches for change events on fields for column updates. Change events are triggered by a modification in a fields value between the time it gains and loses focus. Calendar Date Select modifies the value without giving or removing focus to the field.
If you don't feel like updating your plugins, you could hack it together your self by doing the following:
to