jquery-datatables-rails排序箭头未显示在开发环境中

时间:2021-01-23 23:33:51

I have a new rails install. I followed the instructions on this page exactly: https://github.com/rweng/jquery-datatables-rails

我有一个新的rails安装。我完全按照本页上的说明操作:https://github.com/rweng/jquery-datatables-rails

When I try to view a datatable, I get these errors:

当我尝试查看数据表时,我收到以下错误:

GET http://localhost:3000/images/sort_both.png 404 (Not Found)
GET http://localhost:3000/images/sort_asc.png 404 (Not Found)

In config/environments/development.rb I've tried changing the following settings:

在config / environments / development.rb中,我尝试更改以下设置:

config.assets.debug = false #and also tried true
config.serve_static_assets = true #and also tried false
config.assets.enabled = true

I've also tried running rake assets:precompile

我也尝试过运行rake资产:预编译

Not sure what I'm missing here. Any help would be greatly appreciated.

不知道我在这里缺少什么。任何帮助将不胜感激。

2 个解决方案

#1


15  

Perhaps someone will present a better answer. This is how I fixed it.

也许有人会提出更好的答案。这是我修复它的方式。

I got rid of the gem. Downloaded the javascript and css files from the datatables website:

我摆脱了宝石。从datatables网站下载了javascript和css文件:

Put these files in vendor/assets/stylesheets and vendor/assets/javascripts respectively.

将这些文件分别放在vendor / assets / stylesheets和vendor / assets / javascripts中。

I downloaded the missing images from here and stuck them in my vendor/assets/images folder that I created.

我从这里下载了丢失的图像并将它们粘贴在我创建的vendor / assets / images文件夹中。

I did a replace all on the text in jquery.dataTables.min.css and replaced "/images/" with "/assets/"

我在jquery.dataTables.min.css中对文本进行了全部替换,并将“/ images /”替换为“/ assets /”

And that fixed it. Hope this helps someone.

并修复了它。希望这有助于某人。

#2


0  

I had the same problem and fixed it using a different version of the jquery.dataTables.min.css file, where the images are written as strings rather than as references to a file.

我有同样的问题并使用不同版本的jquery.dataTables.min.css文件修复它,其中图像被写为字符串而不是文件的引用。

#1


15  

Perhaps someone will present a better answer. This is how I fixed it.

也许有人会提出更好的答案。这是我修复它的方式。

I got rid of the gem. Downloaded the javascript and css files from the datatables website:

我摆脱了宝石。从datatables网站下载了javascript和css文件:

Put these files in vendor/assets/stylesheets and vendor/assets/javascripts respectively.

将这些文件分别放在vendor / assets / stylesheets和vendor / assets / javascripts中。

I downloaded the missing images from here and stuck them in my vendor/assets/images folder that I created.

我从这里下载了丢失的图像并将它们粘贴在我创建的vendor / assets / images文件夹中。

I did a replace all on the text in jquery.dataTables.min.css and replaced "/images/" with "/assets/"

我在jquery.dataTables.min.css中对文本进行了全部替换,并将“/ images /”替换为“/ assets /”

And that fixed it. Hope this helps someone.

并修复了它。希望这有助于某人。

#2


0  

I had the same problem and fixed it using a different version of the jquery.dataTables.min.css file, where the images are written as strings rather than as references to a file.

我有同样的问题并使用不同版本的jquery.dataTables.min.css文件修复它,其中图像被写为字符串而不是文件的引用。