PDA

View Full Version : problem in grid totaling



rubynile
27 Aug 2009, 10:06 PM
Am doing total for each line item in a grid.when i first enter the value for 4 lines its giving correct total for each line item.if suppose i go back to 1st line and change the value its not totaling correctly just its taking 4th line's total as total for 1st line.if any one know please help me.this is my code



function getNoOfDays()
{

var fromDate= Ext.getCmp('reseravation_start_date').value;
var toDate=Ext.getCmp('reseravation_end_date').value;
var no_of_days='0';
Ext.Ajax.request({
url:'../crm/getNoOfDays.jsp?fromDate='+fromDate+'&toDate='+toDate,
method:'POST',
waitMsg:'Submitting',
success:function(data){

no_of_days=data.responseText;
var ModifiedRecords = quoteStore.getModifiedRecords();
for(idx=0;idx<ModifiedRecords.length;idx++)
{
rentalprice= ModifiedRecords[idx].data['rentalprice'];
mounting= ModifiedRecords[idx].data['illumCharge'];
printing= ModifiedRecords[idx].data['proInstCharg'];
display= ModifiedRecords[idx].data['extacost'];

// if(idx>=1){
// ModifiedRecords[idx].data['total']='0';
// }
//rentalprice4= ModifiedRecords[idx].data['agecomm'];
// agecomm=parseFloat(rentalprice)*(parseFloat(rentalprice4)/100);
tot=parseFloat(mounting)+parseFloat(printing)+parseFloat(display);//+parseFloat(agecomm)
// fintot=tot+(tax/100);
if(tot=="NaN" || tot=="null")
{tot=0;}
// Ext.getCmp('total').setRawValue(Math.round(tot));
// Ext.getCmp('total').setRawValue(Math.round(tot));
document.getElementById("total").value=Math.round(tot);
document.getElementById("extacost").value=Math.round((parseFloat(rentalprice)/30)*parseFloat(no_of_days));
}
//document.getElementById("total").value=Math.round(tot);
},
failure:function(data){
}
}
)
}

Condor
28 Aug 2009, 1:01 AM
Why are you using getModifiedRecords instead of getRange if you want all records?

rubynile
28 Aug 2009, 4:31 AM
till now i didnt use getrange.can you give me a samplecode for this and help me.