0

このドキュメントは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,

お願い助けて!コンテキストメニューにアクションを追加したい。

4

1 に答える 1

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

それは今働いています!!!

于 2015-02-19T14:05:26.087 に答える