OtavioF
6 Nov 2012, 6:09 AM
I'm trying to do my TabPanel tab blink when give a message error, but my TabPanel is created with xtype, in the example I found, it is created as var = new TabPanel Ext.TabPanel ({}) and then used an override in a file. js to be able to blink using tabPanel.blinkTab (); wherever you need, how to do this with xtype?
example link: http://extdesenv.com.br/extjs/examples/blinkTab/index.html
my code:
//Cria formulário
formulario = Ext.widget('form',{
xtype: 'form',
layout: 'form',
bodyPadding: 5,
border: false,
items: [{
xtype: 'textfield',
fieldLabel: 'Descrição',
name: 'descricao',
id: 'descricao',
allowBlank: false
},{
xtype:'tabpanel',
plain:true,
activeTab: 0,
height:320,
margin: '20 0 0 0',
defaults:{
bodyPadding: 10
},
items:[{
title: 'Pontuação Comercial',
defaultType: 'textfield',
layout: 'vbox',
items: grid2
},{
title:'Templates',
defaultType: 'textfield',
layout: 'vbox',
items: grid3
}]
},{
xtype: 'textfield',
name: 'acao2',
id: 'acao2',
value: 'inserir',
hidden: true
},{
xtype: 'textfield',
name: 'idproduto',
id: 'idproduto',
value: '',
hidden: true
}],
buttons: [{
text: 'Salvar',
handler: function() {
var form = this.up('form').getForm(), s = '';
if (form.isValid()) {
jQuery.ajax({
type: "POST",
dataType: 'json',
url: "../comercial/produtos",
data: form.getValues(),
beforeSend: function(){
},
success: function(d){
if(d.acao == 'inserir'){
formulario.getForm().reset();
//error message and blink here
store.load();
win.close();
}else{
formulario.getForm().reset();
store.load();
win.close();
}
}
});
}
}
},{
text: 'Cancelar',
handler: function() {
formulario.getForm().reset();
win.close();
}
}]
});
example link: http://extdesenv.com.br/extjs/examples/blinkTab/index.html
my code:
//Cria formulário
formulario = Ext.widget('form',{
xtype: 'form',
layout: 'form',
bodyPadding: 5,
border: false,
items: [{
xtype: 'textfield',
fieldLabel: 'Descrição',
name: 'descricao',
id: 'descricao',
allowBlank: false
},{
xtype:'tabpanel',
plain:true,
activeTab: 0,
height:320,
margin: '20 0 0 0',
defaults:{
bodyPadding: 10
},
items:[{
title: 'Pontuação Comercial',
defaultType: 'textfield',
layout: 'vbox',
items: grid2
},{
title:'Templates',
defaultType: 'textfield',
layout: 'vbox',
items: grid3
}]
},{
xtype: 'textfield',
name: 'acao2',
id: 'acao2',
value: 'inserir',
hidden: true
},{
xtype: 'textfield',
name: 'idproduto',
id: 'idproduto',
value: '',
hidden: true
}],
buttons: [{
text: 'Salvar',
handler: function() {
var form = this.up('form').getForm(), s = '';
if (form.isValid()) {
jQuery.ajax({
type: "POST",
dataType: 'json',
url: "../comercial/produtos",
data: form.getValues(),
beforeSend: function(){
},
success: function(d){
if(d.acao == 'inserir'){
formulario.getForm().reset();
//error message and blink here
store.load();
win.close();
}else{
formulario.getForm().reset();
store.load();
win.close();
}
}
});
}
}
},{
text: 'Cancelar',
handler: function() {
formulario.getForm().reset();
win.close();
}
}]
});