このドキュメントは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,
お願い助けて!コンテキストメニューにアクションを追加したい。