【问题标题】:Select2 produces very strange-looking formSelect2 产生非常奇怪的形式
【发布时间】:2014-07-17 01:04:24
【问题描述】:

我在代码中做错了什么导致 select2 在下面的行为如此奇怪?

1) 我希望表单在此处的示例中看起来应该如此,而不是我所拥有的。 例子: http://ivaynberg.github.io/select2/index.html#basics

2) 我希望数据正确 POST 并保存,但它没有保存到数据库中。

(请右击,然后选择“查看图片”放大阅读。)

我已按照 select2 API 说明进行操作。 https://github.com/argerim/select2-rails

问题是来自 gem 冲突、引导程序冲突还是我正在使用的 rails 表单助手?


我也查看了这些线程,但我无法找出解决方案。

preloading external json into select box then after search getting specific results

Select2 initSelection

Select2 does not create name attribute

【问题讨论】:

    标签: ruby-on-rails forms api autocomplete select2-rails


    【解决方案1】:

    关于奇怪的表单布局的问题 #1 的答案。

    我无法让它看起来与模型完全一样,还有其他问题,但这里是解决方案的一个重要部分。

    在 application.css.scss 文件下,不能使用多个 cmets 部分。它需要看起来像这样:

    /*
     *= require select2
     *= require select2-bootstrap
     *
     *= require_self
     *= require_tree .
     */
    

    不喜欢这样

    /*
     *= require select2
     *= require select2-bootstrap
     */
    /*
     *= require_self
     *= require_tree .
     */
    

    我知道,wtf,对吧?经验 不过,它就是这样。

    希望这可以帮助人们保持头发数量。 =]

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-06-14
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多