1. #1
    Ext User
    Join Date
    Jan 2008
    Posts
    140
    Vote Rating
    0
    amey7p is on a distinguished road

      0  

    Default [Solved!!!]new Ext.grid.RowNumberer() problem!!!

    [Solved!!!]new Ext.grid.RowNumberer() problem!!!


    hi i am using

    new Ext.grid.RowNumberer(),
    in column model...

    it renders grid properly with proper serial numbers for rows...

    if i delete any row from grid ...row numbers below that dont get updated ...

    Example if i delete 26th row...then serial numbers for row are from 1st to 25th & then from 27th to bottom...there is no 25th serial number...

    so any work around for this issue??

    thanks & regards,
    - Amey

  2. #2
    Sencha - Ext JS Dev Team evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    16,642
    Vote Rating
    582
    evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute

      0  

    Default


    Post some code please.

  3. #3
    Ext User
    Join Date
    Jan 2008
    Posts
    140
    Vote Rating
    0
    amey7p is on a distinguished road

      0  

    Default


    full code:

    Code:
    Ext.onReady(function(){
    
        Ext.BLANK_IMAGE_URL = '../js/extjs/resources/images/default/s.gif';
        Ext.QuickTips.init();
    
        function formatDate(value){
            return value ? value.dateFormat('d-M-Y') : '';
        };
        
        var fm = Ext.form;
        
        var store_2 = new Ext.data.SimpleStore({fields: ['field2'],data : [["dips"],["sneha"]]});
    var store_3 = new Ext.data.SimpleStore({fields: ['field3'],data : [["UnAssigned"],["Skip"],["dips"],["sneha"]]})
    ;
        
        var mcolumn = [new Ext.grid.RowNumberer(),{header: "Name",dataIndex:'Name',id:'extjscss0',editor: new Ext.form.TextField({allowBlank :false,blankText:'This is a required Field'})},{header: "Initiator",dataIndex:'Initiator',id:'extjscss1',editor: new Ext.form.ComboBox({store:store_2,displayField:'field2',typeAhead: true,editable:false ,mode: 'local',triggerAction: 'all',lazyRender:true,allowBlank :false,blankText:'This is a required Field'})},{header: "Reviewer",dataIndex:'Reviewer',editor: new Ext.form.ComboBox({store:store_3,displayField:'field3',typeAhead: true,editable:false ,mode: 'local',triggerAction: 'all',lazyRender:true})}];
        
        var cm = new Ext.grid.ColumnModel(mcolumn);
        
        cm.defaultSortable = true;
        
        var mreader = [{name:'Name' },{name:'Initiator' },{name:'Reviewer' }];
        
        var extJsRecord = Ext.data.Record.create(mreader);
        
        var AvailHeight = getFrameDimension('height');
        
    	var ActualHeight= AvailHeight-xHeight('commandButtons') -xHeight('IconBar')-10 ;
    	
    	var AvailWidth = getFrameDimension('width');
    	
    	var ActualWidth = AvailWidth ;
    	
    	var w_ExtJSColumnValues= [['','dips','UnAssigned'],['','dips','UnAssigned'],['','dips','UnAssigned'],['','dips','UnAssigned'],['','dips','UnAssigned'],['','dips','UnAssigned'],['','dips','UnAssigned'],['','dips','UnAssigned'],['','dips','UnAssigned'],['','dips','UnAssigned'],['','dips','UnAssigned'],['','dips','UnAssigned'],['','dips','UnAssigned'],['','dips','UnAssigned'],['','dips','UnAssigned'],['','dips','UnAssigned'],['','dips','UnAssigned'],['','dips','UnAssigned'],['','dips','UnAssigned'],['','dips','UnAssigned'],['','dips','UnAssigned'],['','dips','UnAssigned'],['','dips','UnAssigned'],['','dips','UnAssigned'],['','dips','UnAssigned'],['','dips','UnAssigned'],['','dips','UnAssigned'],['','dips','UnAssigned'],['','dips','UnAssigned'],['','dips','UnAssigned'],['','dips','UnAssigned'],['','dips','UnAssigned'],['','dips','UnAssigned'],['','dips','UnAssigned'],['','dips','UnAssigned'],['','dips','UnAssigned'],['','dips','UnAssigned'],['','dips','UnAssigned'],['','dips','UnAssigned'],['','dips','UnAssigned'],['','dips','UnAssigned'],['','dips','UnAssigned'],['','dips','UnAssigned'],['','dips','UnAssigned'],['','dips','UnAssigned'],['','dips','UnAssigned'],['','dips','UnAssigned'],['','dips','UnAssigned'],['','dips','UnAssigned'],['','dips','UnAssigned']];
        
        var myReader = new Ext.data.ArrayReader({},mreader);
        
        var store = new Ext.data.Store({
            data : w_ExtJSColumnValues ,
            proxy: new Ext.data.HttpProxy({url: '1'}),  
            reader:myReader
        });
        
        Ext.override(Ext.form.Field, {
                fireKey : function(e) {
                    if(((Ext.isIE && e.type == 'keydown') || e.type == 'keypress') && e.isSpecialKey()) {
                        this.fireEvent('specialkey', this, e);
                    }
                    else {
                        this.fireEvent(e.type, this, e);
                    }
                }
              , initEvents : function() {
    //                this.el.on(Ext.isIE ? "keydown" : "keypress", this.fireKey,  this);
                    this.el.on("focus", this.onFocus,  this);
                    alert('yy');
                    this.el.on("blur", this.onBlur,  this);
                    this.el.on("keydown", this.fireKey, this);
                    this.el.on("keypress", this.fireKey, this);
                    this.el.on("keyup", this.fireKey, this);
            
                    // reference to original value for reset
                    this.originalValue = this.getValue();
                }
            });
        
        var sm = new Ext.grid.RowSelectionModel({singleSelect:true});
        
        var grid = new Ext.grid.EditorGridPanel({
            cm: cm,
            store : store,
            listeners: {
    			cellclick: function(grid, rowIndex, colIndex) {
    			    var rec = grid.store.getAt(rowIndex);
    				},
    			'keydown': function(e){
    			document.eformmultiadditems.Save.disabled = false;
    			document.eformmultiadditems.Save.className = "ActionButton";
    			}
    			},
    		columns : mcolumn ,
            applyTo: 'ListDiv',
            width:ActualWidth,
            selModel:sm,
            height:ActualHeight,
            autoWidth: Ext.isIE ? false : true,
    		autoScroll :true,		
    		header: false,
    		headerAsText : false,
    		frame:false,
            clicksToEdit:1,
            elements:'body',
            tbar: [{
    				//text:'Delete',//=w_itemName
    				tooltip: 'Delete tr12',
    				iconCls:'delete-btn',
    				listeners: {
    					'click' : function(){
    						var selectedItem = sm.getSelected();
    						if (!selectedItem) {
    							Ext.Msg.alert('Warning', 'Please select an tr12 to delete.');
    							return false;
    						}
    					
    						handleDelete = function (btn){
    							if(btn == 'ok') {
    								store.remove(selectedItem);
    								var extjsaddrow= new extJsRecord({'Name':'','Initiator':'dips','Reviewer':'UnAssigned'});
    								grid.stopEditing();
                    				store.insert(49, extjsaddrow);
                    				grid.startEditing(0, 0);
    							}
    						}
    						Ext.MessageBox.show({
    							title:'Confirm your action',
    							msg: 'Are you sure you want to delete this tr12 ?',
    							buttons: Ext.MessageBox.OKCANCEL,
    							fn: handleDelete
    						});
    					}
    				}
    			}]
            
         });
        
        store.load();
    });
    Last edited by evant; 22 Feb 2008 at 4:37 AM. Reason: Please use [code][/code] tags

  4. #4
    Ext User
    Join Date
    Jan 2008
    Posts
    140
    Vote Rating
    0
    amey7p is on a distinguished road

      0  

    Default


    any help on this one??

  5. #5
    Ext User
    Join Date
    Jan 2008
    Posts
    140
    Vote Rating
    0
    amey7p is on a distinguished road

      0  

    Default


    plzzzzzzzz

  6. #6
    Sencha - Community Support Team Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,246
    Vote Rating
    82
    Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of

      0  

    Default


    This is standard behaviour (to save on grid updates it only removes one row and doesn't update any other rows).

    You either have to call grid.getView().refreshRow(row) for all rows following the deleted row or call grid.getView().refresh() to refresh all rows.

  7. #7
    Ext User
    Join Date
    Jan 2008
    Posts
    140
    Vote Rating
    0
    amey7p is on a distinguished road

      0  

    Default


    this is my code on delete row button

    Code:
    handleDelete = function (btn){       //function to delete row from grid
    							if(btn == 'ok') {
    								store.remove(selectedItem); //remove selected row
    								var extjsaddrow= new extJsRecord({'!Name':'','!Date Identified32323':'2/25/2008 2:53:56 PM','!#Initiator':'tsadmin','!#Reviewer':'UnAssigned'}); //data for addition of item which is called automatically after deletion of row,extjsaddrow this variable is declared & initiated in this API
    								grid.getView().refresh();
    								grid.stopEditing();
    								store.insert(49, extjsaddrow); // extjsaddrow variable is added at 49th position(50th row) after deletion of record
    								grid.startEditing(0, 0);
    							}
    						}
    for first delete its working properly but its not adding row @ 50th position

    & for all next deletes its not working...
    plz help me condor

    thnx

  8. #8
    Sencha - Community Support Team Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,246
    Vote Rating
    82
    Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of

      0  

    Default


    Try:

    Code:
    handleDelete = function (btn){
      if(btn == 'ok') {
        grid.stopEditing();
        store.remove(selectedItem);
        var extjsaddrow= new extJsRecord({'!Name':'','!Date Identified32323':'2/25/2008 2:53:56 PM','!#Initiator':'tsadmin','!#Reviewer':'UnAssigned'});
        store.insert(49, extjsaddrow);
        grid.getView().refresh();
        grid.startEditing(0, 0);
      }
    }

  9. #9
    Ext User
    Join Date
    Jan 2008
    Posts
    140
    Vote Rating
    0
    amey7p is on a distinguished road

      0  

    Default


    thnx condor issue solved....basically issue was because wrong date format passed in default value of date field....thnxxxxx

  10. #10
    Ext User
    Join Date
    Jun 2007
    Posts
    4
    Vote Rating
    0
    ethan is on a distinguished road

      0  

    Default


    thanks,
    this thread helps me