Results 1 to 2 of 2

Thread: Error when click grid body

  1. #1
    Sencha User
    Join Date
    Aug 2013
    Posts
    3

    Default Error when click grid body

    I am using ext v4.2.1, the open source one.
    Here's some code i tried to make

    roleGrid
    Code:
    Ext.define('roleGrid',{
        extend: 'Ext.grid.Panel',
        holder: null,
        lane:null,
        columns: [
            {text:'Start Date',dataIndex:'start_date',
                editor:{
                    xtype: 'datefield',
                    format: 'M-Y'
                },renderer: Ext.util.Format.dateRenderer('M-Y')
            },
            {text:'Position',dataIndex:'position',
                editor: {
                    xtype: 'combo',
                    store: ['any','one','here']),
                    displayField: 'displaytext',
                    valueField: 'value',
                    emptyText:'Select Position'
                },flex:1,
                renderer:function(val,meta,rec,ridx,cidx,str,view) {
                    val = ''+val;
                    val = val.indexOf('.')>-1? val:val+'.0';
                    return this.posDict[''+val];
                }
            },
            {text:'Work Status',dataIndex:'work_status',
                editor: {
                    xtype:'combo',
                    store: ['any','one','here'],
                    displayField:'value',
                    valueField:'value',
                    emptyText:'Select Work Status'
                },width:180
            },
            {text:'Require TLS?',dataIndex:'req_tls',
                editor: {
                    xtype:'combo',
                    store:['Yes','No'],
                    emptyText:'Select value'
                },width:100,renderer:function(val,meta,rec) {
                    if(Ext.decode(val)) return "No";
                    else return "Yes";
                }
            },
            {text:'Well Control',dataIndex:'well_control',
                editor: {
                    xtype:'combo',
                    store:['No','Yes'],
                    emptyText:'Select value'
                },width:100,renderer:function(val,meta,rec) {
                    if(Ext.decode(val)) return "Yes";
                    else return "No";
                }
            }
        ],
        initComponent: function() {
            var self = this;
            self.cellEditing = new Ext.grid.plugin.CellEditing({
                clicksToEdit: 1
            });
            var tbarItems = [{xtype:'button',text:'New',name:'newrow',scope:self,handler:self.insertRow},
            {xtype:'button',text:'Delete'},{xtype:'button',text:'Refresh',scope:self,handler:self.refresh}];
            self.saveButton = new Ext.button.Button({
                xtype:'button',text:'Save',scope:self,scale:'large',handler:self.saveRecord,disabled:true
            });
            var bbarItems = ['->',self.saveButton];
            Ext.apply(this,{
                tbar: tbarItems,
                bbar: bbarItems,
                saveButton: self.saveButton,
                store: Ext.create('roleStore',{
                    holder:self.holder,lane:self.lane}),
                plugins: [self.cellEditing]
            });
            this.callParent(arguments);
            this.getStore().load()
        },
        insertRow: function() {
            var newentry = {
                'holder': this.ggi,
                'start_date':new Date(),
                'pos_id':null,
                'position':null,
                'well_control':null,
                'req_tls':null,
                'work_status':null
            }
            this.getStore().add(newentry);
        },
        getMonthIdx: function(idx) {
            var months = ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'];
            return months.indexOf(idx);
        },
        getMonthString: function(date) {
            var month = date.getMonth();
            var year = date.getFullYear();
            var months = ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'];
            return months[month]+'-'+year;
        },
        refresh: function() {
            this.getStore().load();
        }
    });
    The store
    Code:
    Ext.define('roleStore',{
        extend:'Ext.data.Store',
        holder:null,
        lane: null,
        fields:[
            {name:'holder',type:'string'},
            {name:'start_date',type:'date',dateFormat:'M-Y'},
            {name:'pos_id',type:'float'},
            {name:'position',type:'string'},
            {name:'well_control',type:'string'},
            {name:'req_tls',type:'string'},
            {name:'work_status',type:'string'}
        ],
        summarize: function() {
            var self = this;
            debugger
        },
        listeners: {
            update: function(store,rec,opttype) {
                store.sort('start_date','ASC');
            }
        },
        autoLoad:true
    });
    So now whenever i make a new row, edit the cell, then click the anywhere on grid's body, an error raised in this section
    // If an editor plugin is active, we carefully replace just the *contents* of the cell.
    if (isEditing) {
    Ext.fly(oldCell).syncContent(newCell);
    }
    in the ext-all-debug-w-comments.js
    saying
    TypeError: Ext.fly(...) is null
    I have no idea why this happens. Somebody help

  2. #2
    Sencha User slemmon's Avatar
    Join Date
    Mar 2009
    Location
    Boise, ID
    Posts
    6,165
    Answers
    505

    Default

    I'm having trouble getting your example to work at all. Can you take a look and see if it runs for you ok (prior to getting to your specific issue you're seeing even)?

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
  •