Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ruby-on-rails/66.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails FooTable在ruby on rails项目中不起作用_Ruby On Rails_Ruby_Footable - Fatal编程技术网

Ruby on rails FooTable在ruby on rails项目中不起作用

Ruby on rails FooTable在ruby on rails项目中不起作用,ruby-on-rails,ruby,footable,Ruby On Rails,Ruby,Footable,我正在尝试在RubyonRails项目中使用FooTable,我以前从未使用过FooTable,但我无法让它工作 我已经在gem文件中插入了gem“footable on rails”,并运行了捆绑安装 我已经在app/vendor/assets/javascript和app/assets/javascript中插入了footable.js,这是最佳/正确的位置 我已经在app/vendor/assets/stylesheet和app/assets/stylesheet中插入了footable.

我正在尝试在RubyonRails项目中使用FooTable,我以前从未使用过FooTable,但我无法让它工作

我已经在gem文件中插入了gem“footable on rails”,并运行了捆绑安装

我已经在app/vendor/assets/javascript和app/assets/javascript中插入了footable.js,这是最佳/正确的位置

我已经在app/vendor/assets/stylesheet和app/assets/stylesheet中插入了footable.core.css

我创建了这个名为footable_init.js的文件

我还将application.js文件更改为:

还有我的application.css

注意,我也在使用引导

最后,我的观点如下:

<!DOCTYPE html>
<html lang="en">
    <head>
        <title>App</title>
        <meta charset="UTF-8" />
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> 
        <meta name="viewport" content="width=device-width, initial-scale=1.0"> 

        <%= stylesheet_link_tag 'footable.core.css' %>
  <%= javascript_include_tag 'footable.js', 'data-turbolinks-track' => true %>
  <%= javascript_include_tag 'footable_init.js', 'data-turbolinks-track' => true %>
  <%= javascript_include_tag 'jquery.js', 'data-turbolinks-track' => true %>

    </head>
    <body>
        <table class="table">
        <thead>
                <tr>
                        <th>Name</th>
                        <th data-hide="tablet,phone">Age</th>
                </tr>
         </thead>
        <tbody>
            <tr>
                <td>Luke</td>
                <td>45</td>
            </tr>
            <tr>
                <td>Amy</td>
                <td>28</td>
            </tr>
            <tr>
                <td>Carl</td>
                <td>25</td>
            </tr>
        </tbody>
        </table>
    </body>     
</html>
但当我转到手机或平板电脑分辨率时,我会同时看到这两个栏。 我错过了什么

我原以为在我的rails项目中加入FooTable会很容易,但这花费了我太多的时间。 提前感谢。

您添加了footable.js三次,而不是一次。gem已经通过在application.js中添加require'footable on rails'包含了JavaScript。CSS文件也是如此

无需将它们同时添加到应用程序或供应商目录中。删除这些文件,看看是否有帮助

此外,还必须包含应用程序文件。据补充


您可以链接到gem存储库吗?另外,您不必手动插入JS和CSS文件,因为gem会为您执行此操作。删除这些文件,看看是否有帮助我还必须从应用程序和供应商目录中删除footable.core.css文件吗?是的,CSSIt也一样,但仍然不起作用。是否有必要在我的视图文件中包含所有这些javascript文件?删除这些行,您不能包含不存在的内容-而是包含应用程序文件,我更新了答案
    //= require turbolinks
    //= require bootstrap.min
    //= require footable-on-rails
    //= require jquery
    //= require jquery-ui
    //= require jquery_ujs

//= require_tree .
 *= require bootstrap.min
 *= require footable-on-rails
 *= require_tree .
 *= require_self
 */
<!DOCTYPE html>
<html lang="en">
    <head>
        <title>App</title>
        <meta charset="UTF-8" />
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> 
        <meta name="viewport" content="width=device-width, initial-scale=1.0"> 

        <%= stylesheet_link_tag 'footable.core.css' %>
  <%= javascript_include_tag 'footable.js', 'data-turbolinks-track' => true %>
  <%= javascript_include_tag 'footable_init.js', 'data-turbolinks-track' => true %>
  <%= javascript_include_tag 'jquery.js', 'data-turbolinks-track' => true %>

    </head>
    <body>
        <table class="table">
        <thead>
                <tr>
                        <th>Name</th>
                        <th data-hide="tablet,phone">Age</th>
                </tr>
         </thead>
        <tbody>
            <tr>
                <td>Luke</td>
                <td>45</td>
            </tr>
            <tr>
                <td>Amy</td>
                <td>28</td>
            </tr>
            <tr>
                <td>Carl</td>
                <td>25</td>
            </tr>
        </tbody>
        </table>
    </body>     
</html>
<%= stylesheet_link_tag "application", media: "all" %>
<%= javascript_include_tag "application" %>