2015-06-05 29 views
0

我是Ruby On Rails中的新成員。我希望我的書的圖像和其他字段在網格視圖(矩陣視圖)中顯示在我的索引頁中。所以我安裝了wice_grid寶石。但是當我加載我的索引頁面時,彈出窗口顯示wice_grid.js未加載,WiceGride無法繼續!我遵循:Ruby on Rails:想要在網格視圖中顯示內容(矩陣視圖)

https://github.com/leikind/wice_grid

請幫我解決這個問題。

h請告訴我關於.js文件以及如何配置或使用該文件的信息。 我的控制器是 -

class BooksController < ApplicationController 
    def index 
    @book = initialize_grid(Book, per_page: 4) 
end 

索引頁

<%= grid(@book) do |g| 

g.column do |book| 
image_tag book.image.url(:thumb) 
end 

g.column do |book| 
book.name 
end 

g.column do |book| 
book.category 
end 
g.column do |book| 
book.author 
end 
g.column do |book| 
book.price 
end 
g.column do |book| 
book.contact_no 
end 



end -%> 

回答

1

根據文檔

要求WiceGrid中的JavaScript功能JS索引文件:

//= require wice_grid

這裏是一切的application.js的例子WiceGrid需要:

//= require jquery 
    //= require jquery_ujs 
    //= require jquery-ui 
    //= require wice_grid 
    //= require jquery.ui.datepicker 
    //= require_tree . 

您需要添加寶石的JS部分進入的application.js

此文件通常可在app/assets/javascripts/application.js

+0

找到謝謝Avdept ... – AGM

+0

我在哪裏放這些代碼?我知道這個問題是基本的,因爲我在這個行業是新的... – AGM

+0

@AmitGhoshMoulick在你'application.js'文件 – usmanali