Hybrid View

  1. #1
    Ext User jimmyphp's Avatar
    Join Date
    Mar 2007
    Posts
    77
    Vote Rating
    0
    jimmyphp is on a distinguished road

      0  

    Default Error on first column

    Error on first column


    This is my first test with Air.

    I tried to make a simple grid from sqlite table, all ok but only the first column header cause error on mouseover.

    introspector: typeError: Undefined value.

    I tried to change the order of columns, make a new grid with other data, but always the first header column on mouseover give me error.



    PHP Code:
    sms.data.smsStore Ext.extend(Ext.data.Store, {
        
    constructor: function(){
            
    sms.data.smsStore.superclass.constructor.call(this, {
                
    sortInfo: {
                    
    field'sendDate',
                    
    direction"DESC"
                
    },
                
    reader: new Ext.data.JsonReader({
                    
    id'smsId',
                    
    fieldssms.data.smsRecord
                
    })
            });
            
           
    this.conn sms.data.conn;
            
    //SQlite nome tabella, nome ID
            
    this.proxy = new Ext.sql.Proxy(sms.data.conn'sms''smsId'this);
        },
        
        
    addSms: function(phonemessageresult){
            var 
    id Ext.uniqueId();
            var 
    date = new Date();
            
    = new sms.data.smsRecord({
                
    smsIdid,
                
    sendDatedate,
                
    phonephone,
                
    messagemessage,
                
    resultresult
            
    }, id);
            
    this.add(l);
            return 
    l;
        },
        
    init: function(){
            
    this.load();
        }
    }); 
    PHP Code:
    Ext.uniqueId = function(){
        var 
    String(new Date().getTime()).substr(4);
        var 
    'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
        for (var 
    04i++) {
            
    += s.charAt(Math.floor(Math.random() * 26));
        }
        return 
    t;
    }
    sms.data.smsRecord Ext.data.Record.create([
        {
    name'smsId'type:'string'},
        {
    name'sendDate'type:'date'dateFormatExt.sql.Proxy.DATE_FORMATdefaultValue''},
        {
    name'phone'type:'string'},
        {
    name'message'type:'string'},    
        {
    name'result'type:'string'}
    ]);
    sms.data.conn Ext.sql.Connection.getInstance();
    sms.data.sms = new sms.data.smsStore(); 

    PHP Code:
    var smsGrid = new Ext.grid.GridPanel({
        
    title'Registro Sms',
        
    id'smsG',
           
    viewConfig: {
            
    forceFittrue
        
    },
        
    storesms.data.sms,
        
    cm: new Ext.grid.ColumnModel([{
            
    header'Codice',
            
    dataIndex'smsId',
            
    hiddentrue
        
    }, {
            
    header'Data',
            
    dataIndex'sendDate',
            
    rendererExt.util.Format.dateRenderer('m/d/Y H:i'),
            
    sortabletrue
        
    }, {
            
    header'Cellulare',
            
    dataIndex'phone',
            
    sortabletrue
        
    }, {
            
    header'Messaggio',
            
    dataIndex'message',
            
    sortabletrue
        
    }, {
            
    header'Esito',
            
    dataIndex'result',
            
    sortabletrue
        
    }]),
        
    sm: new Ext.grid.RowSelectionModel({
            
    singleSelecttrue
        
    })
    }); 
    Sorry for English.

    Thank's in advance.

  2. #2
    Ext User
    Join Date
    Nov 2007
    Posts
    102
    Vote Rating
    0
    RobSmith is on a distinguished road

      0  

    Default


    Sure that you insert

    <script type="text/javascript" src="air/ext-air.js"></script>

    to your html page?

    I had a similar error with TreePanel. For some reasons you need the air package in order to use the Ext classes.

  3. #3
    Ext User jimmyphp's Avatar
    Join Date
    Mar 2007
    Posts
    77
    Vote Rating
    0
    jimmyphp is on a distinguished road

      0  

    Default


    thnx for reply

    ext-air.js is load & grid work fine.
    I have a error only on fist header column mouseover.

    I tried with no error basic array grid.

  4. #4
    Software Architect
    Join Date
    Sep 2007
    Posts
    13,966
    Vote Rating
    130
    sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light

      0  

    Default


    Yes i can confirm this.

    The error is thrown by the "isMenuDisabled" function of the Ext.grid.ColumnModel.

  5. #5
    Software Architect
    Join Date
    Sep 2007
    Posts
    13,966
    Vote Rating
    130
    sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light

      0  

    Default


    I tracked this down to the "renderHeaders" function of Ext.grid.GridView.

    p.id is set to 0 (if no id is defined) but when p is applied to the "ts.hcell" template, the 0 is missing
    Code:
    <td class="x-grid3-hd x-grid3-cell x-grid3-td-" style="width:317px;"><div   class="x-grid3-hd-inner x-grid3-hd-" unselectable="on" style=""><a class="x-grid3-hd-btn" href="#"></a>Name<img class="x-grid3-sort-icon" src="http://extjs.com/s.gif" /></div></td>
    Giving the column an id != 0 and evertyhing is working fine. This problem only occurs with an id of 0 or undefined, but thn it gets id 0.

    So seems to be something with the Ext.Template class.

  6. #6
    Software Architect
    Join Date
    Sep 2007
    Posts
    13,966
    Vote Rating
    130
    sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light

      0  

    Default


    Code:
    Ext.override(Ext.grid.GridView,{
    renderHeaders : function(){
            var cm = this.cm, ts = this.templates;
            var ct = ts.hcell;
    
            var cb = [], sb = [], p = {};
    var test= new Ext.Template(
                        '<td class="x-grid3-hd x-grid3-cell x-grid3-td-{id}" style="{style}"><div {tooltip} {attr} class="x-grid3-hd-inner x-grid3-hd-{id}" unselectable="on" style="{istyle}">', this.grid.enableHdMenu ? '<a class="x-grid3-hd-btn" href="#"></a>' : '',
                        '{value}<img class="x-grid3-sort-icon" src="', Ext.BLANK_IMAGE_URL, '" />',
                        "</div></td>"
                        );
            for(var i = 0, len = cm.getColumnCount(); i < len; i++){
                p.id = cm.getColumnId(i);
                p.value = cm.getColumnHeader(i) || "";
                p.style = this.getColumnStyle(i, true);
                p.tooltip = this.getColumnTooltip(i);
                if(cm.config[i].align == 'right'){
                    p.istyle = 'padding-right:16px';
                } else {
                    delete p.istyle;
                }
    			
    			
    				air.trace(test.apply(p));
    				air.trace(ct.apply(p));
                cb[cb.length] = ct.apply(p);
            }
            return ts.header.apply({cells: cb.join(""), tstyle:'width:'+this.getTotalWidth()+';'});
        },
    								   });

    the "test" Ext.Template is working fine, but, well, they are the same

    Changing
    Code:
                cb[cb.length] = ct.apply(p);
    to
    Code:
                cb[cb.length] = test.apply(p);
    and everything is working fine. I just copied the template direct into this function.

  7. #7
    Software Architect
    Join Date
    Sep 2007
    Posts
    13,966
    Vote Rating
    130
    sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light

      0  

    Default


    Code:
                                       Ext.override(Ext.grid.GridView,{
    initTemplates : function(){
            var ts = this.templates || {};
            if(!ts.master){
                ts.master = new Ext.Template(
                        '<div class="x-grid3" hidefocus="true">',
                            '<div class="x-grid3-viewport">',
                                '<div class="x-grid3-header"><div class="x-grid3-header-inner"><div class="x-grid3-header-offset">{header}</div></div><div class="x-clear"></div></div>',
                                '<div class="x-grid3-scroller"><div class="x-grid3-body">{body}</div><a href="#" class="x-grid3-focus" tabIndex="-1"></a></div>',
                            "</div>",
                            '<div class="x-grid3-resize-marker"> </div>',
                            '<div class="x-grid3-resize-proxy"> </div>',
                        "</div>"
                        );
            }
    
            if(!ts.header){
                ts.header = new Ext.Template(
                        '<table border="0" cellspacing="0" cellpadding="0" style="{tstyle}">',
                        '<thead><tr class="x-grid3-hd-row">{cells}</tr></thead>',
                        "</table>"
                        );
            }
    
            if(!ts.hcell){
                ts.hcell = new Ext.Template(
                        '<td class="x-grid3-hd x-grid3-cell x-grid3-td-{id}" style="{style}"><div {tooltip} {attr} class="x-grid3-hd-inner x-grid3-hd-{id}" unselectable="on" style="{istyle}">', this.grid.enableHdMenu ? '<a class="x-grid3-hd-btn" href="#"></a>' : '',
                        '{value}<img class="x-grid3-sort-icon" src="', Ext.BLANK_IMAGE_URL, '" />',
                        "</div></td>"
                        );
            }
    
            if(!ts.body){
                ts.body = new Ext.Template('{rows}');
            }
    
            if(!ts.row){
                ts.row = new Ext.Template(
                        '<div class="x-grid3-row {alt}" style="{tstyle}"><table class="x-grid3-row-table" border="0" cellspacing="0" cellpadding="0" style="{tstyle}">',
                        '<tbody><tr>{cells}</tr>',
                        (this.enableRowBody ? '<tr class="x-grid3-row-body-tr" style="{bodyStyle}"><td colspan="{cols}" class="x-grid3-body-cell" tabIndex="0" hidefocus="on"><div class="x-grid3-row-body">{body}</div></td></tr>' : ''),
                        '</tbody></table></div>'
                        );
            }
    
            if(!ts.cell){
                ts.cell = new Ext.Template(
                        '<td class="x-grid3-col x-grid3-cell x-grid3-td-{id} {css}" style="{style}" tabIndex="0" {cellAttr}>',
                        '<div class="x-grid3-cell-inner x-grid3-col-{id}" unselectable="on" {attr}>{value}</div>',
                        "</td>"
                        );
            }
    
            for(var k in ts){
                var t = ts[k];
                if(t && typeof t.compile == 'function' && !t.compiled){
                    t.disableFormats = true;
                   // t.compile();
                }
            }
    
            this.templates = ts;
    
            this.tdClass = 'x-grid3-cell';
            this.cellSelector = 'td.x-grid3-cell';
            this.hdCls = 'x-grid3-hd';
            this.rowSelector = 'div.x-grid3-row';
            this.colRe = new RegExp("x-grid3-td-([^\\s]+)", "");
        }
    								   });
    This override fixes the bug too. So some bug in the new compile function for air?!

    Calling compile on my "test template" and the error is back too. So, maybe someone from the Ext team can help out.

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar