rubynile
30 Sep 2009, 9:02 PM
Am trying to do confirmation message.If am selecting 3 rows from a list for each row it have to ask confirmation.am trying with this code only.but its not working it giving error message as (selectedData[i] is undefined and showing and showing this line .if any one found what is the error in my code please help me:((
function addQuoteData() {
selectedData = QuoteData.getSelectionModel().getSelections();
var billboard_status="",quote_billboard_name="";
if(selectedData.length<=0){
Ext.Msg.alert('Information', "Please select at least one Media");
return ;
}else{
for(i=0;i<selectedData.length;i++) {
billboard_status=selectedData[i].data["billboard_status"];
quote_billboard_name=selectedData[i].data["quote_billboard_name"];
if(billboard_status=="NOT BOOKED"){
var quoteStoreRec = new quoteRecord({
id_billboard:selectedData[i].data["id_billboard"],
code_billboard:selectedData[i].data["quote_billboard_name"],
location:selectedData[i].data["quote_location"],
rentalprice:selectedData[i].data["Billboard_rate"],
proInstCharg:'0.00',
total:'0.00',//Math.round(totals)
extacost:'0.00',
salesorder_deatil_ref_id:'0' ,
illumCharge:'0.00',
installcharge:'0.00',
agecomm:'0.00',
reseravation_start_date:selectedData[i].data["searchstartdate"],
reseravation_end_date:selectedData[i].data["searchenddate"],
invoice_start_date:selectedData[i].data["searchstartdate"],
area:selectedData[i].data["area"]
});
quoteStore.add(quoteStoreRec);
Ext.getCmp('BillboardSearchWin1').close();
}
else if(billboard_status=="Quote Blocked")
{
Ext.Msg.show({
title:'Warning',
msg: 'Are you sure you want to Book,This site '+quote_billboard_name+'is Blocked By ',
buttons:{
yes:true,
no:true
},
fn:function(btn){
if(btn=="yes"){
var quoteStoreRec = new quoteRecord({
id_billboard:selectedData[i].data["id_billboard"],
code_billboard:selectedData[i].data["quote_billboard_name"],
location:selectedData[i].data["quote_location"],
rentalprice:selectedData[i].data["Billboard_rate"],
proInstCharg:'0.00',
total:'0.00',//Math.round(totals)
extacost:'0.00',
salesorder_deatil_ref_id:'0' ,
illumCharge:'0.00',
installcharge:'0.00',
agecomm:'0.00',
reseravation_start_date:selectedData[i].data["searchstartdate"],
reseravation_end_date:selectedData[i].data["searchenddate"],
invoice_start_date:selectedData[i].data["searchstartdate"],
area:selectedData[i].data["area"]
});
quoteStore.add(quoteStoreRec);
Ext.getCmp('BillboardSearchWin1').close();
}else if(btn=='no'){
return;
}
} });
}
}
}
}
function addQuoteData() {
selectedData = QuoteData.getSelectionModel().getSelections();
var billboard_status="",quote_billboard_name="";
if(selectedData.length<=0){
Ext.Msg.alert('Information', "Please select at least one Media");
return ;
}else{
for(i=0;i<selectedData.length;i++) {
billboard_status=selectedData[i].data["billboard_status"];
quote_billboard_name=selectedData[i].data["quote_billboard_name"];
if(billboard_status=="NOT BOOKED"){
var quoteStoreRec = new quoteRecord({
id_billboard:selectedData[i].data["id_billboard"],
code_billboard:selectedData[i].data["quote_billboard_name"],
location:selectedData[i].data["quote_location"],
rentalprice:selectedData[i].data["Billboard_rate"],
proInstCharg:'0.00',
total:'0.00',//Math.round(totals)
extacost:'0.00',
salesorder_deatil_ref_id:'0' ,
illumCharge:'0.00',
installcharge:'0.00',
agecomm:'0.00',
reseravation_start_date:selectedData[i].data["searchstartdate"],
reseravation_end_date:selectedData[i].data["searchenddate"],
invoice_start_date:selectedData[i].data["searchstartdate"],
area:selectedData[i].data["area"]
});
quoteStore.add(quoteStoreRec);
Ext.getCmp('BillboardSearchWin1').close();
}
else if(billboard_status=="Quote Blocked")
{
Ext.Msg.show({
title:'Warning',
msg: 'Are you sure you want to Book,This site '+quote_billboard_name+'is Blocked By ',
buttons:{
yes:true,
no:true
},
fn:function(btn){
if(btn=="yes"){
var quoteStoreRec = new quoteRecord({
id_billboard:selectedData[i].data["id_billboard"],
code_billboard:selectedData[i].data["quote_billboard_name"],
location:selectedData[i].data["quote_location"],
rentalprice:selectedData[i].data["Billboard_rate"],
proInstCharg:'0.00',
total:'0.00',//Math.round(totals)
extacost:'0.00',
salesorder_deatil_ref_id:'0' ,
illumCharge:'0.00',
installcharge:'0.00',
agecomm:'0.00',
reseravation_start_date:selectedData[i].data["searchstartdate"],
reseravation_end_date:selectedData[i].data["searchenddate"],
invoice_start_date:selectedData[i].data["searchstartdate"],
area:selectedData[i].data["area"]
});
quoteStore.add(quoteStoreRec);
Ext.getCmp('BillboardSearchWin1').close();
}else if(btn=='no'){
return;
}
} });
}
}
}
}