我在https://github.com/netzke/netzke/wiki/Adding-custom-actions-to-a-component写了这个文档,但我不明白这一点。
undefined method `js_method'全组分码
class Airports < Netzke::Basepack::Grid
include Netzke::Basepack::ActionColumn
js_method :on_show_details, <<-JS
function(){
var tmpl = new Ext.Template("<b>{0}</b>: {1}<br/>"), html = "";
Ext.iterate(this.getSelectionModel().selected.first().data, function(key, value){
html += tmpl.apply([key.humanize(), value]);
}, this);
Ext.Msg.show({
title: "Details",
width: 300,
msg: html
});
}
JS
def configure(c)
super
c.title = "Airports"
c.model = "Airport"
c.columns = [...]
end
end我为什么会犯这个错误?
undefined method `js_method' for Airports:Class
Extracted source (around line #2):
1: <h1>Аэропорты</h1>
2: <%= netzke :airports,
3: # :class_name => "Netzke::Basepack::Grid",
4: :border => true,请救救我!我想将操作添加到上下文菜单中。
发布于 2015-02-19 14:05:26
我回答。我写了change.log,我得到了这个东西。
js_configure do |c|
c.on_show = <<-JS
function(){
var tmpl = new Ext.Template("<b>{0}</b>: {1}<br/>"), html = "";
Ext.iterate(this.getSelectionModel().selected.first().data, function(key, value){
html += tmpl.apply([key.humanize(), value]);
}, this);
Ext.Msg.show({
title: "Details",
width: 300,
msg: html
});
}
JS
end现在起作用了!
https://stackoverflow.com/questions/28593995
复制相似问题