我在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,
请帮帮我! 我想在上下文菜单中添加操作。
答案 0 :(得分:0)
我回答。 我写了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
现在正在工作!!!