我體驗到使用netzke
+ rails 4
+ extjs-4.2.1
每次顯示的div在頁面第一次加載一個奇怪的行爲,但網格未裝載直到我刷新頁面。我無法使用rails 3
+ netzke 0.8
+ extjs-4.1
重現錯誤。這可能是一個netzke錯誤?我使用瀏覽器控制檯並且不顯示錯誤。電網將不能在第一頁加載呈現(Netzke + Rails的4 + ExtJS的)
我目前使用這個版本netzke的:
gem "netzke-core", "~> 0.10.0.rc2"
gem "netzke-basepack", "~> 0.10.0.rc2"
和Rails 4.0.2
與extjs-4.2.1
我application.html.erb
<!DOCTYPE html>
<html>
<head>
<title>Railroad</title>
<%= stylesheet_link_tag "application", media: "all", "data-turbolinks-track" => true %>
<%= javascript_include_tag "application", "data-turbolinks-track" => true %>
<%= load_netzke %>
<%= csrf_meta_tags %>
</head>
<body>
<div id="wrap">
<div id="header">
<div>
<h1>Demo</h1>
<hr/>
</div>
<div style="float: left;">
<% if I18n.locale == I18n.default_locale %>
<%= link_to "Español", :locale=>'es'%>
<% else %>
<%= link_to "English", :locale=>'en'%>
<%end%>
</div>
<div style="float: right;">
<% if user_signed_in? %>
<%= link_to (t :sign_out), destroy_user_session_path, :method => :delete %>
<% end %>
</div>
</div>
<div id="main-content">
<%= render 'layouts/messages' %>
<%= yield %>
</div>
<div id="footer">
<hr/>
</div>
</div>
</body>
</html>
我的歡迎/ index.html.erb
<h2><%= t :post_option %></h2>
<ul>
<li><%= link_to (t :post_list), posts_path%></li>
<li><%= link_to (t :post_new), new_post_path%></li>
</ul>
個
我的帖子/ index.html.erb
<h2>TEST</h2>
<%= netzke :posts, height: 400 %>
<br/>
<%= link_to (t :back), root_path %>
我的routes.rb
Railroad::Application.routes.draw do
devise_for :users, :controllers => {:registrations => "registrations", :omniauth_callbacks => "omniauth_callbacks"}
resources :posts do
resources :comments
end
netzke
root "welcome#index"
end
我的模型post.rb
class Post < ActiveRecord::Base
has_many :comments, dependent: :destroy
validates :title, presence: true, length: { minimum: 5 }
private
def post_params
params.require(:post).permit(:title, :text)
end
end
我的部件/ posts.rb
class Posts < Netzke::Basepack::Grid
def configure(c)
super
c.model = "Post"
c.columns = [
:title,
:text
]
c.prohibit_update = true
c.prohibit_delete = false
end
end
謝謝您的幫助。
更新
的問題出現時,我點擊link_to
它送我到頁面與網格,但它沒有使用0.10.0.rc2
作爲導致電網未加載,直到我刷新執行NetzkeController
進行相關NetzkeController
頁面,但如果我在0.8的NetzkeController
中執行相同的場景,則調用它並加載網格。
這裏是頁之後的日誌文件是netzke 0.8
和renderes 0.10.0rc2
0.8
Started GET "/test/view" for 127.0.0.1 at 2014-03-19 09:07:48 -0600
Processing by TestController#view as HTML
Rendered test/view.html.erb within layouts/application (19.2ms)
Completed 200 OK in 42ms (Views: 41.6ms | ActiveRecord: 0.0ms)
[2014-03-19 09:07:48] WARN Could not determine content-length of response body. Set content-length of the response or set Response#chunked = true
Started GET "/netzke/ext.css" for 127.0.0.1 at 2014-03-19 09:07:48 -0600
Processing by NetzkeController#ext as CSS
Rendered text template (0.0ms)
Completed 200 OK in 2ms (Views: 0.3ms | ActiveRecord: 0.0ms)
[2014-03-19 09:07:48] WARN Could not determine content-length of response body. Set content-length of the response or set Response#chunked = true
Started GET "/netzke/ext.js" for 127.0.0.1 at 2014-03-19 09:07:48 -0600
Processing by NetzkeController#ext as JS
Rendered text template (0.0ms)
Completed 200 OK in 1ms (Views: 0.2ms | ActiveRecord: 0.0ms)
[2014-03-19 09:07:48] WARN Could not determine content-length of response body. Set content-length of the response or set Response#chunked = true
Started POST "/netzke/direct/?authenticity_token=vkC6OERWwyDwHU5Hqnqpu%2BH83PNpqLnikPADBoZvrME%3D" for 127.0.0.1 at 2014-03-19 09:07:48 -0600
0.10.0rc2
Started GET "/posts" for 127.0.0.1 at 2014-03-18 13:02:58 -0600
Processing by PostsController#index as HTML