PDA

View Full Version : Issue with getting the tab selected



likame
5 Jun 2012, 1:28 PM
I have a tabpanel with 3 grids inside, phone, email and address, but I want to delete just 1 record if I has selected 3 rows differents in 3 grids, follow the code:



var Detail = new Ext.TabPanel({
activeTab: 0,
border: false,
height: 175,
defaults:{autoScroll: true},
items:[{
id: 'aba1',
title: 'Telefones',
items: gridTelefone,
layout: 'fit'
},{
id: 'aba2',
title: 'E-mails',
items: gridEmail,
layout: 'fit'
},{
id: 'aba3',
title: 'Endereços',
items: gridEndereco,
layout: 'fit'
}
]
});




function excluirTelefone() {
if(gridTelefone.getSelectionModel().hasSelection() && Detail.getItemId() == 'aba1'){
var exctrecord = gridTelefone.getSelectionModel().getSelected();
Ext.Msg.confirm(
'Atenção',
'Confirma a exclusão definitiva do telefone selecionado?',
function(btn){
if(btn == 'yes'){
Ext.Ajax.request({
url: '../php/escola/excluirTelefone.php',
params: {cod_fone: exctrecord.data.cod_fone},
success: function(){
Ext.Msg.alert('Sucesso','Registro excluído com sucesso');
dsTelefone.reload();
},
failure: function(){
Ext.Msg.alert('Erro', 'Não foi possível excluir o registro');
}
})
}
}
);
}
else{
Ext.Msg.alert('Atenção', 'É preciso selecionar o registro que se deseja excluir.');
}
}


it always enter in the 'else' sentence, what's the problem?

Regards!

scottmartin
5 Jun 2012, 1:55 PM
Have you verified your header to see if the correct record is sent?
params: {cod_fone: exctrecord.data.cod_fone},

On your server side, have you verified your SQL is receiving this value and only deleting this record?

Regards,
Scott.

likame
5 Jun 2012, 2:16 PM
Everything else is going correctly, for example, if I remove the Detail.get~ the code enters in the 'if' and delete correctly the register, but if I has selection in 3 rows of 3 panels, I just can delete the phone.

sword-it
12 Jun 2012, 12:26 AM
Hi

did you debug that on firebug or chrome developer tool?

Regards