Results 1 to 4 of 4

Thread: [OPEN-EXTJSIV-1649]RowEditing improvement suggestions

    Thank you for reporting this bug. We will make it our priority to review this report.
  1. #1
    Sencha Premium Member
    Join Date
    Dec 2010
    Posts
    55

    Default [OPEN-EXTJSIV-1649]RowEditing improvement suggestions

    It would be great to add canceledit event to RowEditing plugin. That would enable scenario in which on cancel phantom rows are removed. If store is set to autoSync phantom rows really have no sense.

    In the grid we can then configure canceledit listener:
    Code:
    listeners: {
    				scope: this,
    				'canceledit': function (params) {
    					if (params.record.phantom)
    						store.remove(params.record);
    				}
    			},
    Even better solution would be to add property removePhantomsOnCancel and remove phantoms inside the plugin.

    Code:
    Ext.override(Ext.grid.plugin.RowEditing, {
    	
    	constructor: function(config) {
            var me = this;
            Ext.apply(me, config);
            me.addEvents(
                'beforeedit',
                'edit',
                'canceledit'
            );
            me.mixins.observable.constructor.call(me);
        },
    
        init: function(grid) {
            var me = this;
    
            me.grid = grid;
            me.view = grid.view;
            me.initEvents();
            me.initFieldAccessors(grid.headerCt.getGridColumns());
            grid.relayEvents(me, ['canceledit', 'beforeedit', 'edit']);
        },
    	
    	cancelEdit: function() {
            var me = this;
    
            if (me.editing) {
                me.getEditor().cancelEdit();
                me.editing = false;
                me.fireEvent('canceledit', me.params);
                if (me.removePhantomsOnCancel && me.params.record.phantom)
                	me.grid.store.remove(me.params.record);
            }
            
        }
    });
    Checkout Dextop or Pecunia demo.

  2. #2
    Sencha Premium Member
    Join Date
    Dec 2010
    Posts
    55

    Default

    One more thing I found really useful in this scenario is

    Code:
    Ext.override(Ext.data.Store, {	
    	insertPhantom: function(index, rec) {
    		var autoSync = this.autoSync;
            this.autoSync = false;
            this.insert(index, rec);
            this.autoSync = autoSync;		
    	}	
    });
    This way you can edit phantom row, even if store is set to autoSync.
    If row edit/entry is canceled row is removed and it's not sent to the server.
    Checkout Dextop or Pecunia demo.

  3. #3
    Sencha User atian25's Avatar
    Join Date
    Oct 2008
    Location
    china
    Posts
    114

    Default

    +1

    it seems that at ext4.0 :
    me.fireEvent('canceledit', me.params);
    got error , params is undefined.

    should change to:
    Code:
    if (this.editing) {
      this.getEditor().cancelEdit();
      this.editing = false;
      this.fireEvent('canceledit', this.context); 
      if (this.removePhantomsOnCancel){
        if(this.context.record.phantom){
           this.context.store.remove(this.context.record);
        }else{
           this.context.record.reject()
        }
       }
    }
    and i also add a fn startAdd, see http://www.sencha.com/forum/showthre...mp-amp-feature

  4. #4
    Sencha User atian25's Avatar
    Join Date
    Oct 2008
    Location
    china
    Posts
    114
    @from: china
    @web: http://atian25.iteye.com
    @extensions: (extjs 4.x)
    * Ext.ux.grid.plugin.RowEditing - add some usefull features (v1.4 updated 2011-09-11)
    * Ext.ux.button.AutoRefresher
    * Ext.ux.form.field.DateTime

Similar Threads

  1. Replies: 1
    Last Post: 12 Jul 2011, 6:12 PM
  2. Replies: 1
    Last Post: 11 Apr 2011, 6:48 PM
  3. Replies: 1
    Last Post: 8 Apr 2011, 3:45 PM
  4. [OPEN] [FIXED-EXTJSIV-150]A couple of chart suggestions...
    By James Goddard in forum Ext:Bugs
    Replies: 21
    Last Post: 8 Apr 2011, 9:48 AM
  5. Ext.form.FieldSet Improvement-Suggestions
    By tobiu in forum Community Discussion
    Replies: 1
    Last Post: 14 Jun 2008, 5:26 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •