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 回答