|
danielextjs
Visitante
|
 |
« : Abril 27, 2012, 08:24:52 » |
|
o sistema não exibe interface no internet explorer 8 segue codigo:
/** * @author Daniel Santiago * @classDescription Classe que estende a Ext.form.FormPanel que irá públicar * editais. */ //form panel var PublicarEditais = Ext.extend(Ext.Container,{ //configuracao do form panel border : false ,padding : 10 ,baseCls : 'x-plain' ,defaults : { layout : 'form' ,margins : 10 ,bodystyle : 'padding 3px' }, publicacao : [], publicacao_dou : [], //inicializando os componentes da classe initComponent : function(){ this.storePublicarEditais = new Ext.data.JsonStore({ url : '../editais/pesquisar_editais_publicar', storeId : 'storePublicar', autoLoad : false, autoDestroy : true, root : 'dados', totalProperty : 'total', baseParams : { start : 0, limit : 15 }, fields : [ {name : 'id' ,mapping : 'Edital__id' ,type : 'int' } ,{name : 'numero' ,mapping : 'Edital__numero' ,type : 'string' } ,{name : 'nome' ,mapping : 'Edital__nome' ,type : 'string' } ,{name : 'publicacao' ,mapping : 'Edital__data_publicacao' ,type : 'string' } ,{name : 'publicacao_dou' ,mapping : 'Edital__data_publicacao_dou' ,type : 'string' } ], listeners : { 'load' : { scope : this, fn : this.onStoreEditaisLoad } } }); //buscando o numero de linhas this.rowNumber = new Ext.grid.RowNumberer(); //store para tipos de editais this.storeTipos = new Ext.data.JsonStore({ autoLoad : true, url : '../editais/buscar_tipos', root : 'dados' ,fields : [ {name : 'id' ,mapping : 'TiposEdital.id' ,type : 'int' } ,{name : 'nome' ,mapping : 'TiposEdital.descricao' ,type : 'string' } ], }); //comboBox para tipos de editais this.cbTipos = new Ext.form.ComboBox({ triggerAction : 'all', valueField : 'id', typeAhead : true, name : 'data[conditions][tipos_edital_id]', hiddenName : 'data[conditions][tipos_edital_id]', displayField : 'nome', mode : 'local', width : 650, emptyText : 'Selecione um tipo', store : this.storeTipos, style : 'margin-left: 50px;', width : 210 }); var fm = Ext.form; //grid publicar editais, campos data publicação e data publicação DOU do tipo editable this.gridPublicar = new Ext.grid.EditorGridPanel({ id : 'grid_publicar', stripeRows : true, height : 413, border : true, clicksToEdit: 1, region : 'center', height : 280, loadMask : { msg : 'Carregando tabela, por favor aguarde...', iconCls : 'x-mask-loading' }, viewConfig : { forceFit : true }, disabled : true, autoScroll : true, enableHdMenu: false, border : true, store : this.storePublicarEditais, //toolbar para gerenciar resultados bbar : new Ext.PagingToolbar({ displayInfo : true, pageSize : 15, store : this.storePublicarEditais, displayMsg : 'Mostrando {0} - {1} de {2}', items:[ '-',{ text : 'Mostrar', enableToggle: true }] }), tbar : this.gridPublicar, enableHdMenu: false, sm : new Ext.grid.RowSelectionModel({singleSelect:true}), columns : [ this.rowNumber, {header : 'N° do edital' ,align : 'center' ,width : 75 ,dataIndex:'numero' ,sortable: true}, {header : 'Nome do documento' ,align : 'center' ,width : 350 ,dataIndex:'nome' ,sortable: true}, {header : 'Data da publicação' ,editor: {xtype : 'datefield', format: 'd/m/Y'} ,format : 'd/m/Y' ,id: 'data_publicacao' ,sortable : false ,align : 'center' ,width : 75 ,dataIndex:'data_publicacao' ,renderer : Ext.util.Format.dateRenderer('d/m/Y')}, {header : 'Data da publicação no DOU' ,editor: {xtype : 'datefield', format: 'd/m/Y'} ,format : 'd/m/Y' ,id: 'data_publicacao_dou' ,sortable : false ,align : 'center' ,width : 120 ,dataIndex:'data_publicacao_dou' ,renderer : Ext.util.Format.dateRenderer('d/m/Y')} ], listeners : { cellclick : function(grid, row, col, e){ var record = grid.getStore().getAt(row); publicacao = record.get('data_publicacao'); publicacao_dou = record.get('data_publicacao_dou'); Ext.getCmp('button-salvar').enable(); } } }); //formulário de cadastro this.formPublicarEditais = new Ext.form.FormPanel({ labelWidth : 200, id : 'form_publicar', border : false, padding : 4, margins : 1, items : [{ xtype : 'fieldset', ref : 'formulario', consapsible : true, heigth : 180, width : 1190, padding : 4, margins : 1, title : 'Dados da Pesquisa', items : [{ fieldLabel : 'Número do edital', xtype : 'compositefield', sytle : 'margin-left : 2px', items : [{ xtype : 'textfield', name : 'data[conditions][numero]', id : 'edital-numero', maxLength : 20, style : 'margin-left : 2px', },{ xtype : 'displayfield', value : 'Ano:', style : 'margin-left : 10px; font-weight: bold;', },{ xtype : 'numberfield', name : 'data[conditions][ano]', style : 'margin-left : 15px', width : 50, minLength : 4, maxLength : 4, alowBlack : false },{ xtype : 'compositefield', style : 'margin-left : 80px; font-weight : bold;', value : 'Tipo do edital:', items : [{ xtype : 'displayfield', name : 'data[conditions][tipo]', value : 'Tipo do edital', style : 'margin-left:1px', size : 20 },this.cbTipos,{ iconCls : 'icon-add', style : 'margin-left:50px;', } ]} ]},{ border : false, fieldLabel : 'Nome do documento', xtype : 'compositefield', sytle : 'margin-left : 2px;', items : [{ xtype : 'textfield', name : 'data[conditions][nome]', anchor : '100%', maxLength : 50, width : 243, style : 'margin-left : 2px', },{ xtype : 'checkbox', boxLabel : 'Não publicado', name : 'nao_public', style : 'margin-left : 200px; font-weight: bold;', id : 'check-nao-publicado', scope : this, handler : this.limparCheck }] },{ xtype : 'checkbox', boxLabel : 'Não publicado no DOU', name : 'nao_public_dou', style : 'margin-left : 448px' }] },{ xtype : 'button', iconCls : 'icon-pesquisa', style : 'margin-left : 1050', text : 'Pesquisar', scope : this, handler : this.onClickPesquisar },{ xtype : 'fieldset', title : 'Resultado da pesquisa', items : [ this.gridPublicar,{ style : 'margin-left : 20px' }] },{ xtype : 'button', id : 'button-salvar', iconCls : 'icon-save', style : 'margin-left : 1050', text : 'Gravar', handler : function(){ Ext.Msg.show({ title : 'Publicar Edital', msg : 'Tem certeza que deseja publicar este edital?', buttons : Ext.Msg.YESNO, fn : function(btn){ if(btn == 'yes'){ var arrayIds = new Array(); Ext.each(Ext.getCmp('grid_publicar').getSelectionModel().getSelections(),function(rec){ arrayIds.push(rec.get('id')); },this); Ext.getCmp('form_publicar').getForm().submit({ url : '../editais/publicar_editais', method : 'post', scope : this, params : { 'data_publicacao' : this.publicacao, 'id' : arrayIds, 'data_publicacao_dou' : this.publicacao_dou }, success : function(){ Ext.Msg.alert('Mensagem','Edital publicado com sucesso no sistema!'); } }); } } }); }, scope : this, disabled: true, }], }); //aplicando formulario Ext.apply(this,{ items : [this.formPublicarEditais] }); //Super PublicarEditais.superclass.initComponent.call(this) } //evento para verificar campos ,onValidarPesquisa : function(){ var tipo = this.formPublicarEditais.getForm().findField('data[conditions][tipos_edital_id]').getValue(); var numero = this.formPublicarEditais.getForm().findField('data[conditions][numero]').getValue(); var ano = this.formPublicarEditais.getForm().findField('data[conditions][ano]').getValue(); var nome = this.formPublicarEditais.getForm().findField('data[conditions][nome]').getValue(); var nao_publicado = this.formPublicarEditais.getForm().findField('nao_public').getValue(); var nao_publicado_dou = this.formPublicarEditais.getForm().findField('nao_public_dou').getValue(); if(tipo == "" && numero == "" && ano == "" && nome == "" && nao_publicado == "" && nao_publicado_dou == ""){ return false; }else{ return true; } } //função para pesquisar editais ,onClickPesquisar : function(){ if(this.onValidarPesquisa()){ Ext.getCmp('grid_publicar').enable(); var filtro = this.formPublicarEditais.getForm().getValues(); console.log(filtro); this.storePublicarEditais.setBaseParam('data[conditions][nao_publicado]',this.formPublicarEditais.getForm().findField('nao_public').getValue()); this.storePublicarEditais.setBaseParam('data[conditions][nao_publicado_dou]',this.formPublicarEditais.getForm().findField('nao_public_dou').getValue()); Ext.apply(this.storePublicarEditais.baseParams, filtro); this.storePublicarEditais.load(); this.onHabilitarButtonSalvar(); }else{ this.onMensagem('Existem campo(s) obrigatorio(s) a serem preenchidos!'); Ext.getCmp('grid_publicar').disable(); } } //função para habilitar o botao salvar ,onHabilitarButtonSalvar : function(){ Ext.getCmp('button-salvar').enable(); } //verifica se há registro no store ,onStoreEditaisLoad : function(store, record, options){ if(store.getCount() == 0){ Ext.Msg.show({ title : 'Mensagem', msg : 'Nenhum registro encontrado!', buttons : Ext.Msg.OK, animEl : 'elId', icon : Ext.MessageBox.INFO, }); Ext.getCmp('button-salvar').disable(); Ext.getCmp('grid_publicar').disable(); } } //mensagem de controle ,onMensagem : function(texto){ Ext.Msg.show({ title : 'Mensagem', msg : texto, buttons : Ext.Msg.OK, animEl : 'elId', icon : Ext.MessageBox.INFO, }); }, limparCheck : function(){ } }) //registrando.. Ext.reg('ux-PublicarEditais',PublicarEditais);
|