0

Netzke Gridでは、レコードの削除中に確認を求められます。
適用アクションと保存アクションに同じことをどのように実装できますか。

ありがとう。

4

1 に答える 1

1

これを試して。モデルは、国コードと国名を含む単純な国テーブルです。重要な部分はjs_configure方法にあります。

class Countries < Netzke::Basepack::Grid

  def configure(c)
    super
    c.model = 'Country'
    c.persistence = true
    c.columns = [
      { name: :code, width: 100 },
      { name: :name, header: 'Country Name', width: 300 }
    ]
  end

  js_configure do |c|
    c.init_component = <<-JS
      function() {
        var t = this;
        t.callParent();

        t.onApply = (function() {
          t._onApply = t.onApply;
          return function() {
            Ext.Msg.confirm(t.i18n.confirmation,
            t.i18n.areYouSure, function(btn) {
              if (btn == 'yes') {
                t._onApply();
              }
            })
          }
        })();
      }
    JS
  end
end
于 2013-05-29T14:35:27.567 に答える