I made one mistake in the callback function and it appears to be working more like the way I think it should. However, the title is in column 1, and doesn’t span across columns. I .
[code]mygrid.setColumnHidden(2,true);
mygrid.setColTypes(“ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ron,ron,ron,ron,ron,ron,ron,ron”);
mygrid.setSkin(“dhx_skyblue”);
mygrid.enableColSpan(true);
mygrid.init();
mygrid.splitAt(1);
mygrid.loadXML(“Data_Project_List.php”,function(){
mygrid.groupBy(2,[“#title”,“#cspan”,“#cspan”,“#cspan”,“”,“”,“”,“”,“”,“”,“”,“”,“”,“”,“”,“”,“”,“”,“”,“”,“”,“”,“”,“”,“”,“”,“”,“”,“”]);
for (var a in mygrid._groups){ // for each group
var id=mygrid.getUID();
mygrid.addRow(id,[“”,“”,a]) // add total row
mygrid.setRowColor(id,“#FFFFCC”)
mygrid.setRowExcellType(id,“ro”)
mygrid.setColspan(id,0,18); //count of columns in grid
var bdgtTotal=0;
mygrid.forEachRow(function(id){ //calculate grid total
if (mygrid.cells(id,this._gIndex).getValue()==a)
bdgtTotal+=parseFloat(mygrid.cells(id,20).getValue()); // 3 - index of column for calculations
})
var cmmtTotal=0;
mygrid.forEachRow(function(id){
if (mygrid.cells(id,this._gIndex).getValue()==a)
cmmtTotal+=parseFloat(mygrid.cells(id,21).getValue());
})
var invTotal=0;
mygrid.forEachRow(function(id){
if (mygrid.cells(id,this._gIndex).getValue()==a)
invTotal+=parseFloat(mygrid.cells(id,22).getValue());
})
var expTotal=0;
mygrid.forEachRow(function(id){
if (mygrid.cells(id,this._gIndex).getValue()==a)
expTotal+=parseFloat(mygrid.cells(id,23).getValue());
})
var hcTotal=0;
mygrid.forEachRow(function(id){
if (mygrid.cells(id,this._gIndex).getValue()==a)
hcTotal+=parseFloat(mygrid.cells(id,24).getValue());
})
var scTotal=0;
mygrid.forEachRow(function(id){
if (mygrid.cells(id,this._gIndex).getValue()==a)
scTotal+=parseFloat(mygrid.cells(id,25).getValue());
})
mygrid.cells(id,19).setValue("Total:"); // set total value
mygrid.cells(id,20).setValue(bdgtTotal); // set total value
mygrid.cells(id,21).setValue(cmmtTotal); // set total value
mygrid.cells(id,22).setValue(invTotal); // set total value
mygrid.cells(id,23).setValue(expTotal); // set total value
mygrid.cells(id,24).setValue(hcTotal); // set total value
mygrid.cells(id,25).setValue(scTotal); // set total value
}
});
[/code]
If I move “#title” to the first position in the array it appears in column 1, but it does not span across columns like I want it to.
Also I have some group totals that are calculated in the call back function that no longer display in the correct columns. They did before I moved the group by in to the callback. I’m sure I have the syntax wrong. Thanks for your help.