Here is the code. following method "printCertified()" recieves bean array from java class. This method first converts bean array into multiD array, then sets images for column 3 and 5 and after that it write grid object on document. I am very new to Active Widgets, I may go wrong at very basic level too. Any type of help will appriciated.
function printCertified(options)
{
var i=0;
optionList1 = new Array();
for (var data in options)
{
list=new Array();
list[0]=options[data].requestId;
list[1]=options[data].externalRef;
list[2]=options[data].statusName;
list[3]=options[data].regFlag;
list[4]=options[data].regLevel;
list[5]=options[data].priorety;
list[6]=options[data].mntFlag;
list[7]=options[data].productLine;
list[8]=options[data].version;
list[9]=options[data].product;
list[10]=options[data].labstract;
list[11]=options[data].owner;
list[12]=options[data].objectiveDate;
list[13]=options[data].modificationDate;
list[14]=options[data].activity;
list[15]=options[data].level1;
list[16]=options[data].customer;
optionList1[i]=list;
i=i+1;
}
var header=["RequestID", "Num", "Status", "Reg", "Reg Level", "Sevirety", "Mgnt", "Product Line", "Version", "Product", "Abstract", "Owner", "ObjectiveDate", "ModificationDate","Activity","Level1","Customer"];
var obj = new AW.Grid.Extended;
obj.setSize(990,350);
obj.setHeaderText(header);
obj.setColumnCount(17);
obj.setRowCount(i);
obj.setSelectorVisible(true);
obj.setSelectorText(function(i){return this.getRowPosition(i)+1});
if(i>999)
obj.setSelectorWidth(40);
else
obj.setSelectorWidth(25);
obj.setSelectionMode("single-row");
obj.setCellData(function(col, row){return col + "." + row});
function image(col, row){
if (this.getCellText(5, row) == "1") {
return "p1";
}
else if (this.getCellText(5, row) == "2") {
return "p2";
}
else if (this.getCellText(5, row) == "3") {
return "p3";
}
else if (this.getCellText(5, row) == "4") {
return "p4";
}
}
obj.setCellTemplate(new AW.Templates.Image, 5);
obj.setCellImage(image, 5);
obj.setCellData(function(col, row){return col + "." + row});
function imageReg(col, row){
if (this.getCellText(3, row) == "1") {
return "reg";
}
else
return;
}
obj.setCellTemplate(new AW.Templates.Image, 3);
obj.setCellImage(imageReg, 3);
obj.onCellDoubleClicked = function(event, column, row){
if(column==1)
window.open( 'Case?requestid='+this.getCellText(0,row), '', 'width=300,height=200,top=120,left=120,menubar=1, toolbar=1, resizable=1, scrollbars=1, status=1' );
};
obj.setCellText(optionList1);
document.write(obj);