Results 1 to 8 of 8

Thread: f is undefined in RowEditor.js line 169 when add row using RowEditor

  1. #1
    Ext User
    Join Date
    Aug 2009
    Posts
    20
    Vote Rating
    0
      0  

    Question f is undefined in RowEditor.js line 169 when add row using RowEditor

    I got error f is undefined in line 169 RowEditor.js Extjs 3.2.1 when add or edit using row editor with restful. I have tree menu with xtype refers to tab. the problem appears when close tab roweditor after add or edit and re-open tab roweditor and try to add or edit again. is it bug? any idea please? thx.

    this is RowEditor.js
    PHP Code:
        startEditing: function(rowIndexdoFocus){
            if(
    this.editing && this.isDirty()){
                
    this.showTooltip(this.commitChangesText);
                return;
            }
            if(
    Ext.isObject(rowIndex)){
                
    rowIndex this.grid.getStore().indexOf(rowIndex);
            }
            if(
    this.fireEvent('beforeedit'thisrowIndex) !== false){
                
    this.editing true;
                var 
    this.gridview g.getView(),
                    
    row view.getRow(rowIndex),
                    
    record g.store.getAt(rowIndex);
                
    this.record record;
                
    this.rowIndex rowIndex;
                
    this.values = {};
                if(!
    this.rendered){
                    
    this.render(view.getEditorParent());
                }
                var 
    Ext.fly(row).getWidth();
                
    this.setSize(w);
                if(!
    this.initialized){
                    
    this.initFields();
                }
                var 
    cm g.getColumnModel(), fields this.items.itemsfval;
                for(var 
    0len cm.getColumnCount(); leni++){
                    
    val this.preEditValue(recordcm.getDataIndex(i));
                    
    fields[i];
                    
    f.setValue(val); // line 169
                    
    this.values[f.id] = Ext.isEmpty(val) ? '' val;
                }
                
    this.verifyLayout(true);
                if(!
    this.isVisible()){
                    
    this.setPagePosition(Ext.fly(row).getXY());
                } else{
                    
    this.el.setXY(Ext.fly(row).getXY(), {duration:0.15});
                }
                if(!
    this.isVisible()){
                    
    this.show().doLayout();
                }
                if(
    doFocus !== false){
                    
    this.doFocus.defer(this.focusDelaythis);
                }
            }
        }, 
    this is the example code
    PHP Code:
    Ext.onReady(function () {
        
    Ext.QuickTips.init();
        var 
    TheGrid Ext.extend(Ext.grid.GridPanel, {
            
    title'Test',
            
    autoScrolltrue,
            
    borderfalse,
            
    stripeRowstrue,
            
    loadMasktrue,
            
    columnLinestrue,
            
    collapsibletrue,
            
    animCollapsefalse,
            
    view: new Ext.grid.GroupingView({
                
    forceFittrue,
                
    markDirtyfalse,
                
    groupTextTpl'{text} ({[values.rs.length]} {[values.rs.length > 1 ? "Items" : "Item"]})'
            
    }),
            
    //viewConfig: {
            //    forceFit: true
            //},
            
    editor: new Ext.ux.grid.RowEditor({
                
    saveText'Update'
            
    }),
            
    onAdd: function (btnev) {
                var 
    = new this.store.recordType({
                    
    no'',
                    
    job'',
                    
    date''
                
    });
                
    this.editor.stopEditing(); //make a new empty User and stop any current editing 
                
    this.store.insert(0u); //add our new record as the first row, select it 
                
    this.editor.startEditing(0); //start editing our new User
            
    },
            
    onDelete: function () {
                var 
    rec this.getSelectionModel().getSelected();
                if (
    rec) {
                    
    this.store.remove(rec);
                }
            },
            
    onLoad: function () {
                
    this.store.load();
            },
            
    initComponent: function () {
                var 
    proxy = new Ext.data.HttpProxy({
                    
    url'app.php/users'
                
    });
                var 
    reader = new Ext.data.JsonReader({
                    
    totalProperty'total',
                    
    successProperty'success',
                    
    idProperty'id',
                    
    root'data',
                    
    messageProperty'message' // attribute in server response for user message...
                
    }, [{
                    
    name'id',
                    
    type'int'
                
    },
                {
                    
    name'no',
                    
    type'int'
                
    },
                {
                    
    name'job'
                    
    //type: 'list'
                
    },
                {
                    
    name'date',
                    
    type'date',
                    
    dateFormat'c' // incoming date string is in ISO8601 format
                
    }]);
                var 
    writer = new Ext.data.JsonWriter({
                    
    encodefalse
                
    });
                var 
    userColumns = [
                new 
    Ext.grid.RowNumberer(), {
                    
    id'id',
                    
    header"ID",
                    
    dataIndex'id',
                    
    hiddentrue,
                },
                {
                    
    header"No",
                    
    width30,
                    
    sortabletrue,
                    
    dataIndex'no',
                    
    editor: new Ext.form.TextField({})
                },
                {
                    
    header"Job",
                    
    width50,
                    
    sortabletrue,
                    
    dataIndex'job',
                    
    editor: new Ext.form.TextField({})
                },
                {
                    
    header"Date",
                    
    width100,
                    
    sortabletrue,
                    
    dataIndex'date',
                    
    xtype'datecolumn',
                    
    format'd-m-Y',
                    
    groupRendererExt.util.Format.dateRenderer('Y-m-d'),
                    
    editor: new Ext.form.DateField({
                        
    format'Y-m-d',
                        
    //minValue: '01/01/2000',
                        //minText: 'Can\'t have a start date before 2010!',
                        
    maxValue: (new Date()).format('m/d/Y'),
                        
    disabledDays: [07],
                        
    disabledDaysText'Closed on this day'
                    
    })
                }];
                var 
    store = new Ext.data.GroupingStore({
                    
    restfultrue,
                    
    proxyproxy,
                    
    readerreader,
                    
    writerwriter,
                    
    sortInfo: {
                        
    field'no',
                        
    direction"ASC"
                    
    },
                    
    groupField'job'
                
    });
                var 
    config = {
                    
    storestore,
                    
    plugins: [this.editor],
                    
    columnsuserColumns,
                    
    fbar: ['->', {
                        
    text'Clear Grouping',
                        
    iconCls'icon-clear-group',
                        
    handler: function () {
                            
    store.clearGrouping();
                        }
                    }],
                    
    tbar: [{
                        
    text'Add',
                        
    iconCls'silk-add',
                        
    handlerthis.onAdd,
                        
    scopethis
                    
    },
                    
    '-', {
                        
    text'Delete',
                        
    iconCls'silk-delete',
                        
    handlerthis.onDelete,
                        
    scopethis
                    
    },
                    
    '-', {
                        
    text'Reload',
                        
    iconCls'silk-cog',
                        
    handlerthis.onLoad,
                        
    scopethis
                    
    }]
                };
                
    Ext.apply(thisExt.apply(this.initialConfigconfig));
                
    TheGrid.superclass.initComponent.apply(thisarguments);
            },
            
    onRender: function () {
                
    this.store.load();
                
    TheGrid.superclass.onRender.apply(thisarguments);
            }
        });
        
    Ext.reg('grid'TheGrid);
    }); 

  2. #2
    Sencha User
    Join Date
    Sep 2009
    Location
    Calgary, Alberta, Canada
    Posts
    638
    Vote Rating
    2
      0  

    Default

    What does fields = this.items.items do?

    This is impossible. The first items reference is an array. It needs a call to the actual object.

  3. #3
    Ext User
    Join Date
    Aug 2009
    Posts
    20
    Vote Rating
    0
      0  

    Default

    Quote Originally Posted by CrazyEnigma View Post
    What does fields = this.items.items do?

    This is impossible. The first items reference is an array. It needs a call to the actual object.
    I don't have any idea about it. The RowEditor.js file comes from the original extjs 3.2.1. I didn't modify that file.

  4. #4
    Sencha User
    Join Date
    Sep 2009
    Location
    Calgary, Alberta, Canada
    Posts
    638
    Vote Rating
    2
      0  

    Default

    Why are you posting twice? You should be keeping your thread alive not posting a new thread.

    Did you specify the fields property in your config?!? f is undefined because you didn't specify it?!?

  5. #5
    Ext User
    Join Date
    Aug 2009
    Posts
    20
    Vote Rating
    0
      0  

    Default

    Quote Originally Posted by CrazyEnigma View Post
    Why are you posting twice? You should be keeping your thread alive not posting a new thread.

    Did you specify the fields property in your config?!? f is undefined because you didn't specify it?!?
    sorry, I try to delete the first post in help section or move it to bug section but can't. could you give me example about fields of property in config? this is my var config exactly like my first post:

    PHP Code:
    var config = {
                    
    storestore,
                    
    plugins: [this.editor],
                    
    columnsuserColumns,
                    
    fbar: ['->', {
                        
    text'Clear Grouping',
                        
    iconCls'icon-clear-group',
                        
    handler: function () {
                            
    store.clearGrouping();
                        }
                    }],
                    
    tbar: [{
                        
    text'Add',
                        
    iconCls'silk-add',
                        
    handlerthis.onAdd,
                        
    scopethis
                    
    },
                    
    '-', {
                        
    text'Delete',
                        
    iconCls'silk-delete',
                        
    handlerthis.onDelete,
                        
    scopethis
                    
    },
                    
    '-', {
                        
    text'Reload',
                        
    iconCls'silk-cog',
                        
    handlerthis.onLoad,
                        
    scopethis
                    
    }]
                }; 

  6. #6
    Ext User
    Join Date
    Aug 2009
    Posts
    20
    Vote Rating
    0
      0  

    Default

    Is anybody able to give me a hint ? I currently have a serious issue with this.

    Thank you in advance !

  7. #7
    Sencha User
    Join Date
    Sep 2009
    Location
    Calgary, Alberta, Canada
    Posts
    638
    Vote Rating
    2
      0  

    Default

    So my answer wasn't sufficient. You have never heard of "fields". Go to the API and look it up. RTFM.

  8. #8
    Ext User
    Join Date
    Aug 2009
    Posts
    20
    Vote Rating
    0
      0  

    Default

    Quote Originally Posted by CrazyEnigma View Post
    So my answer wasn't sufficient. You have never heard of "fields". Go to the API and look it up. RTFM.
    don't get it. I'm newbie =( but I try to include fields in store like code below but still got "f is undefined"

    PHP Code:
    var store = new Ext.data.GroupingStore({
        
    restfultrue,
        
    proxyproxy,
        
    readerreader,
        
    writerwriter,
        
    sortInfo: {
            
    field'no',
            
    direction"ASC"
        
    },
        
    groupField'job',
        
    fields: [{
            
    name'id',
            
    type'int'
        
    },
        {
            
    name'no',
            
    type'int'
        
    },
        {
            
    name'job',
            
    type'list'
        
    },
        {
            
    name'date',
            
    type'date',
            
    dateFormat'c'
        
    }]
    }); 

Similar Threads

  1. f is undefined in RowEditor.js line 169 when add row
    By evang in forum Ext 3.x: Help & Discussion
    Replies: 2
    Last Post: 30 May 2010, 9:11 AM
  2. Configure roweditor on treegrid depending on the line
    By Nico33 in forum Ext GWT: Discussion
    Replies: 3
    Last Post: 21 Dec 2009, 2:28 AM
  3. CRUD - RowEditor Store undefined
    By Jack_S in forum Ext 3.x: Help & Discussion
    Replies: 1
    Last Post: 9 Oct 2009, 11:44 PM
  4. CRUD - RowEditor Store undefined
    By Jack_S in forum Ext 3.x: Help & Discussion
    Replies: 0
    Last Post: 9 Oct 2009, 5:01 AM

Tags for this Thread

Posting Permissions

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