Sha256: 02b60d74cfe0f32f7ca8fd9d9f313381c6f8c6149916884b9134b4931dcb0978

Contents?: true

Size: 1.4 KB

Versions: 1

Compression:

Stored size: 1.4 KB

Contents

Ext.override(Netzke.pre.GridPanel, {
  onEditInForm: function(){
    var selModel = this.getSelectionModel();
    if (selModel.getCount() > 1) {
      var recordId = selModel.getSelected().id;
      this.loadComponent({name: "multi_edit_form",
        params: {record_id: recordId},
        callback: function(w){
          var form = w.items.first();
          form.on('apply', function(){
            var ids = [];
            selModel.each(function(r){
              ids.push(r.id);
            });
            if (!form.baseParams) form.baseParams = {};
            form.baseParams.ids = Ext.encode(ids);
          }, this);
          
          w.on('close', function(){
            if (w.closeRes === "ok") {
              this.store.reload();
            }
          }, this);
        }, scope: this});
    } else {
      var recordId = selModel.getSelected().id;
      this.loadComponent({name: "edit_form",
        params: {record_id: recordId},
        callback: function(form){
          form.on('close', function(){
            if (form.closeRes === "ok") {
              this.store.reload();
            }
          }, this);
        }, scope: this});
    }
  },
  
  onAddInForm: function(){
    this.loadComponent({name: "add_form", callback: function(form){
      form.on('close', function(){
        if (form.closeRes === "ok") {
          this.store.reload();
        }
      }, this);
    }, scope: this});
  }
});

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
netzke-basepack-0.6.0 app/components/netzke/basepack/grid_panel/javascripts/edit_in_form.js