1. #1
    Ext User
    Join Date
    Feb 2008
    Posts
    275
    Vote Rating
    0
    Rafael is on a distinguished road

      0  

    Default Errors when open Ext.Window with htmleditor

    Errors when open Ext.Window with htmleditor


    The probleman is a htmleditor.
    When open window with htmleditor in second time have this error:

    Code:
    this.wrap.dom is null
    [IMG]chrome://firebug/content/blank.gif[/IMG]            this.wrap.dom.innerHTML = '';
    
    this.dom is null
    [IMG]chrome://firebug/content/blank.gif[/IMG]        return noBoxAdjust[(this.dom.tag...| "").toLowerCase()] || Ext.isBorderBox;
    
    
    this.dom is null
    [IMG]chrome://firebug/content/blank.gif[/IMG]                    this.dom.style[camel] = value;
    
    
    (c.getPositionEl ? c.getPositionEl() : c.getEl()).dom is null
    [IMG]chrome://firebug/content/blank.gif[/IMG]        return (c.getPositionEl ? c.getP...l()).dom.parentNode == this.innerCt.dom;
    and dont open !

    Code:
    function AbrirChamadoShow(QTD_Chamado){
    
        var WI_AbrirChamado = Ext.getCmp('AbrirChamado');
        if (!WI_AbrirChamado){
            var FP_AbrirChamado = new Ext.FormPanel({
                labelAlign: 'top',
                frame:true,
                title: 'Multi Column, Nested Layouts and Anchoring',
                bodyStyle:'padding:5px 5px 0',
                width: 600,
                items: [{
                    layout:'column',
                    items:[{
                        columnWidth:.5,
                        layout: 'form',
                        items: [{
                            xtype:'hidden',                            
                            name: 'codigo_chamado',
                            id: 'codigo_chamado',
                        },
                        new Ext.form.TriggerField({
                            fieldLabel: 'Nome Empresa',
                            name: 'fantasia_nome',
                            id: 'fantasia_nome',
                            readOnly: true,
                            width: 320,
                            triggerClass: 'lookup',
                            onTriggerClick : function(){
                                LookupEmpresaShow();
                            },
                            anchor:'95%',
                        }),{
                            xtype:'textfield',
                            fieldLabel: 'Data Inicial do Chamado',
                            name: 'data_abertura',
                            id: 'data_abertura',
                            readOnly: true,
                            value: getData(),                        
                            anchor:'95%',
                        },{
                            xtype: 'checkbox',
                            fieldLabel: 'Agendar Visita',
                            align: 'left',
                            name: 'agendar_visita',
                            id: 'agendar_visita',
                        }]
                    },{
                        columnWidth:.5,
                        layout: 'form',
                        items: [{
                            xtype:'hidden',                            
                            name: 'codigo_cliente',
                            id: 'codigo_cliente',
                        },{
                            xtype:'textfield',
                            fieldLabel: 'Nome Funcionàrio',
                            name: 'nome_funcionario',
                            id: 'nome_funcionario',
                            readOnly: true,
                            value: '<?php echo $_SESSION["nome_funcionario"];?>',
                            anchor:'95%',
                        },{
                            xtype:'textfield',
                            fieldLabel: 'Hora Inicial do Chamado',
                            name: 'hora_abertura',
                            id: 'hora_abertura',
                            readOnly: true,
                            value: getHora(),
                            anchor:'95%',
                        },{
                            xtype: 'checkbox',
                            labelAlign: 'left',
                            fieldLabel: 'Finalizar Chamado',
                            name: 'finalizar_chamado',
                            id: 'finalizar_chamado',
                            listeners: {
                                check: function( cb, state ) {
                                    if( state == true ) {
                                        Ext.getCmp("observacao").setValue(Ext.getCmp("observacao").getValue() + "<br><center><b>Solução</b></center><br>");
                                    }else{
                                        Ext.getCmp("observacao").setValue(Solucao(Ext.getCmp("observacao").getValue()));
                                    }
                                }
                            },
                        }]
                    }]
                },{ 
                    xtype: 'htmleditor',
                    //xtype: 'textarea',
                    id:'observacao',
                    fieldLabel:'Observacao',
                    height:300,
                    anchor:'98%',
                }],
    
                buttons: [{
                    text:'Salvar',
                    formBind: true,
                    id: 'btn_salvar_chamado',
    
                    /*---------------- CADASTRA O CHAMADO NO BANCO DE DADOS -----------------*/
                    handler: function(){   
                        //if( FP_AbrirChamado.getForm().isValid() ){
                            var dados_chamado = [];
                            dados_chamado.push( FP_AbrirChamado.getForm().getValues());
                            Ext.Ajax.request({
                                url: 'insert.php',
                                method:'POST',
                                params: { parametro: 'Chamado',
                                    dados_chamado: Ext.util.JSON.encode(dados_chamado),
                                },
                                waitMsg: 'Salvando...',   
                                success: function(response) {
                                    var cod_retorno = Ext.decode(response.responseText);
                                    Ext.MessageBox.alert('Status', 'Chamado Cadastrado com Sucesso!!!');
                                    dsChamado.reload();
                                    if( Ext.getCmp('agendar_visita').getValue() == 1 ) {
                                    alert(cod_retorno.codigo_chamado);    Agenda(Ext.getCmp("codigo_cliente").getValue(), Ext.getCmp("fantasia_nome").getValue(), cod_retorno.codigo_chamado);
                                    }
                                    else {
                                        WI_AbrirChamado.close();
                                        WI_AbrirChamado = null;
                                    }
                                },   
                                failure: function() {   
                                    Ext.MessageBox.alert('Status','Save failed');   
                                }
                            });
                    } 
    
                },{
                    text: 'Atualizar',
                    id: 'btn_atualizar_chamado',
                    handler: function(){
                        var dados_chamado = [];
                        dados_chamado.push(FP_AbrirChamado.getForm().getValues());
                        Ext.Ajax.request({
                            url: 'update.php',
                            method:'POST',
                            params:{ 
                                 parametro: 'Atualizar_Chamado', 
                                 codigo_chamado: Ext.getCmp("codigo_chamado").getValue(), 
                                 agendar_visita: Ext.getCmp("agendar_visita").getValue(), 
                                 finalizar_chamado: Ext.getCmp("finalizar_chamado").getValue(),
                                 dados_chamado: Ext.util.JSON.encode(dados_chamado),
                                 observacao: Ext.getCmp("observacao").getValue(),
                            },
                            success:function(response)
                            {
                                var msg_retorno = Ext.decode(response.responseText);
                                if( msg_retorno.success == true ){
                                    if( Ext.getCmp('agendar_visita').getValue() == 1 ) {
                                        Agenda(Ext.getCmp("codigo_cliente").getValue(), Ext.getCmp("fantasia_nome").getValue(), Ext.getCmp("codigo_chamado").getValue());
                                    }
                                    dsChamado.reload();
                                    WI_AbrirChamado.close();
                                    WI_AbrirChamado = null;
                                }
                                else {
                                    alert("Erro");
                                }
                            }
                        });
                    },
    
                },{
                    text: 'Cancelar',
                    id: 'btn_cancelar_chamado',
                    listeners: { 
                        click: function() { 
                            WI_AbrirChamado.close();
                            WI_AbrirChamado = null; 
                        }
                    },
                    
                },{
                    text: 'Agenda',
                    id: 'btn_agenda',
                    handler: function(){
                        MostraAgenda(Ext.getCmp('codigo_chamado').getValue());
                    }
                }],
            });
    
            var WI_AbrirChamado = new Ext.Window({
                modal: true,
                id: 'AbrirChamado',
                title: "Abrir Chamado",
                maximizable: true,
                border: false,
                layout: 'fit',
                closeAction: 'close',
                listeners:{
                    close: function(){
                        WI_AbrirChamado.destroy();
                    }
                },
                width: 700,
                height: 520,
                listeners: { close: function() { WI_AbrirChamado = null; } },
                items: FP_AbrirChamado,
            });
    
        }        
        WI_AbrirChamado.show();
    }
    For test , i change htmleditor for textarea and work , but i need to use htmleditor.

  2. #2
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Notts/Redwood City
    Posts
    30,496
    Vote Rating
    44
    Animal has a spectacular aura about Animal has a spectacular aura about Animal has a spectacular aura about

      0  

    Default


    Overnest. You are putting a column layout Panel inside a FormPanel. Just set the FormPanel to be layout: 'column'.

  3. #3
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Notts/Redwood City
    Posts
    30,496
    Vote Rating
    44
    Animal has a spectacular aura about Animal has a spectacular aura about Animal has a spectacular aura about

      0  

    Default


    Oh no, I see. Your HtmlEditor is below that column Panel.

  4. #4
    Sencha - Community Support Team Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,246
    Vote Rating
    83
    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


    Closing a window will destroy all inner items including the form!

    Either reuse the window (and set closeAction:'hide') or also create a new form when creating a new window.

  5. #5
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Notts/Redwood City
    Posts
    30,496
    Vote Rating
    44
    Animal has a spectacular aura about Animal has a spectacular aura about Animal has a spectacular aura about

      0  

    Default


    Try making the FormPanel layout: 'anchor'

  6. #6
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Notts/Redwood City
    Posts
    30,496
    Vote Rating
    44
    Animal has a spectacular aura about Animal has a spectacular aura about Animal has a spectacular aura about

      0  

    Default


    Oh, I see. This one again!

  7. #7
    Ext User
    Join Date
    Feb 2008
    Posts
    275
    Vote Rating
    0
    Rafael is on a distinguished road

      0  

    Default


    Condor i try this in Window :

    Code:
    closeAction: 'hide',
    listeners:{
        beforehide: function(){
              WI_AbrirChamado.destroy(); and try too WI_AbrirChamado.hide();
        }
    }
    Dont work too.

  8. #8
    Sencha - Community Support Team Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,246
    Vote Rating
    83
    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


    No, you didn't do what I said.

    You have 2 options:

    Option 1: Reuse the window
    Code:
    var win = Ext.getCmp('id-of-window');
    if(!win){
      var form = new Ext.form.FormPanel({...});
      win = new Ext.Window({
        id: 'id-of-window',
        closeAction: 'hide',
        layout: 'fit',
        items: form,
        ...
      });
    }
    win.show();
    Option 2: Destroy and create
    Code:
    var form = new Ext.form.FormPanel({...});
    var win = new Ext.Window({
      id: 'id-of-window',
      closeAction: 'close',
      layout: 'fit',
      items: form,
      ...
    });
    win.show();

  9. #9
    Ext User
    Join Date
    Feb 2008
    Posts
    275
    Vote Rating
    0
    Rafael is on a distinguished road

      0  

    Default


    the first option it is work.

    Condor, have this error:

    Code:
    Denied permission to read the property XULElement.accessibleType
    [IMG]chrome://firebug/content/blank.gif[/IMG]        this.doc.close();
    Why this error ?

    This is a button of close WIndow
    Code:
     text: 'Cancel',
                    id: 'btn_cancelar_chamado',
                    listeners: { 
                        click: function() { 
                            WI_AbrirChamado.close();
                            //WI_AbrirChamado = null; 
                        }
                    },

  10. #10
    Sencha - Community Support Team Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,246
    Vote Rating
    83
    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


    1. Ignore the error. It's not affecting how your application works and it should be removed in Ext 3 RC2.

    2. You are supposed to be reusing the window now, so call win.hide() instead of win.close()!

Thread Participants: 2