I have a timesheet grid that is setup for batch editing. There are row totals and column totals and a bunch of decimal data in each cell. Each row has data for Monday through Friday for the first week and Mo-Fri for the second week. Totals are updated for Week 1 and Week2 as well as the 2 week total. Individual lines in the grid represent projects that are being billed against.
I have the grid set up to calculate the row totals as the user enters information in each cell and tabs to the next by hooking into the gridSave event and running javascript to do a running total and updating the row total field. Here's an example.
What I'd like to do is expand this to also do a column total and update the aggregate in the footer, but I'm not sure how to do this. (Need to have a total for each day of the week). Right now I have it set so that the aggregates properly calculate column totals and display when the grid data is first loaded from the controller, but then they are static until all data is saved and the grid is re-populated. I need real-time updates.
Thanks in advance!
I have the grid set up to calculate the row totals as the user enters information in each cell and tabs to the next by hooking into the gridSave event and running javascript to do a running total and updating the row total field. Here's an example.
//Calculate week sums and total sums
function
gridSave(e) {
var
Mo1_time = e.values.Mo1_time,
Tu1_time = e.model.Tu1_time,
We1_time = e.model.We1_time,
Th1_time = e.model.Th1_time,
Fr1_time = e.model.Fr1_time,
Sa1_time = e.model.Sa1_time,
Su1_time = e.model.Su1_time,
Mo2_time = e.model.Mo2_time,
Tu2_time = e.model.Tu2_time,
We2_time = e.model.We2_time,
Th2_time = e.model.Th2_time,
Fr2_time = e.model.Fr2_time,
Sa2_time = e.model.Sa2_time,
Su2_time = e.model.Su2_time,
Wk1_time = 0,
Wk2_time = 0
Wk1_time = Mo1_time + Tu1_time + We1_time + Th1_time + Fr1_time + Sa1_time + Su1_time;
Wk2_time = Mo2_time + Tu2_time + We2_time + Th2_time + Fr2_time + Sa2_time + Su2_time;
e.model.set(
"Wk1_time"
, Wk1_time);
e.model.set(
"Wk2_time"
, Wk2_time);
e.model.set(
"Sum_time"
, Wk1_time + Wk2_time);
}
What I'd like to do is expand this to also do a column total and update the aggregate in the footer, but I'm not sure how to do this. (Need to have a total for each day of the week). Right now I have it set so that the aggregates properly calculate column totals and display when the grid data is first loaded from the controller, but then they are static until all data is saved and the grid is re-populated. I need real-time updates.
Thanks in advance!