Netzke确认弹出窗口

时间:2013-05-28 11:12:43

标签: ruby-on-rails-3.2 netzke

Netzke Grid 中删除记录时会询问确认
我们如何为申请和保存行动实施相同的目标。

感谢。

1 个答案:

答案 0 :(得分: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
相关问题