:: Forum >>
Check Box & Images in single Column
Hi
Thanks in response.
<Alarms><Alarm AlarmId="1" Age="0:03 " AlarmName="AIRFLOW INCHES" AlarmType="Input Point" Assignment=" " CompanyID="000 " Esc="0 " Lapsed="974:49 " LoggedTime="2007-07-25 20:15:25.92" Nts="note" Pri="10 " SystemID="18500 " SystemName="TE5-Savvy31 " TimeOccurred="2007-07-25 16:12:00.0"/>
<Alarm AlarmId="2" Age="0:03 " AlarmName="HEAT 2/CLOSED" AlarmType="Output Point" Assignment="EAMadministrator " CompanyID="000 " Esc="0 " Lapsed="974:49 " LoggedTime="2007-07-25 20:15:25.937" Nts="note" Pri="10 " SystemID="18500 " SystemName="TE5-Savvy31" TimeOccurred="2007-07-25 16:12:00.0"/>
</Alarms>
This is my sample xml file as a string i have in my jsp.
Now my question is......I want to display this data in AW grid component. In third column i want display one check box with name & values as AlarmId in my xml string.
This is my JSP code.
var ServerXML ='<%=xmlStr%>'; // Here actual xml string will come up
var table = new AW.XML.Table;
table.setXML(ServerXML);
//Here i am setting my data into the grid.
table.setColumns(["@Esc", "@Pri", "@CompanyID", "@SystemID", "@SystemName","@AlarmName","@AlarmType","@TimeOccurred","@Age","@LoggedTime","@Lapsed","@Nts","@Assignment"]);
var columns = ["E", "P", "CC", "Sys #", "System Name","Alarm Name","Alarm Type","Occurred","Age","Logged","Lapsed","Nts","Assigned"];
//Can we write like this to display check box in my grid is it possible.
table.setColumns(["@Esc", "@Pri","<input type=checkbox name=@AlarmId value=@AlarmId onclick='javascript:findABC(this.value)'>" "@CompanyID", "@SystemID", "@SystemName","@AlarmName","@AlarmType","@TimeOccurred","@Age","@LoggedTime","@Lapsed","@Nts","@Assignment"]);
var columns = ["E", "P","s", "CC", "Sys #", "System Name","Alarm Name","Alarm Type","Occurred","Age","Logged","Lapsed","Nts","Assigned"];
var obj = new AW.UI.Grid;
obj.setId("myGrid");
obj.setCellTemplate(new AW.Templates.Image,11);
obj.setCellImage("note",11);
obj.setColumnCount(13);
obj.setRowCount(table.getCount());
obj.setHeaderText(columns);
obj.setRowHeight(30);
obj.setSelectorVisible(false);
obj.setSelectorText(function(i){return this.getRowPosition(i)+1});
obj.setSelectorWidth(25);
obj.setSelectionMode("multi-row");
var str = new AW.Formats.String;
var num = new AW.Formats.Number;
obj.setCellFormat([num,num,num,num,str,str,str,str,str,str,str,str,str]);
obj.setCellModel(table);
document.write(obj);
Narayana Swamy, Bangalore
Tuesday, September 4, 2007
If the checkbox values and images are calculated from data in other columns you can do the following -
1. add empty column for the checkbox (using "" Xpath)-
table.setColumns(["@Esc", "@Pri", "", "@CompanyID", "@SystemID" ...
2. add other data columns at the end (if necessary) -
table.setColumns([... , "@Ack", "@Status"]);
3. calculate values and images and assign them to the grid column
function checkboxValue(col, row){
if (this.getCellData(14, row) == 1){
return true;
}
else {
return false;
}
}
function checkboxImage(col, row){
if(this.getCellData(15, row) == "Resolved"){
return "favorites";
}
else {
return "none";
}
}
obj.setCellValue(checkboxValue, 2);
obj.setCellImage(checkboxImage, 2);
4. assign checkbox template
obj.setCellTemplate(new AW.Templates.Checkbox, 2);
Alex (ActiveWidgets)
Tuesday, September 4, 2007
Hi Alex,
Thanks for your response its working fine for some what?
But the below method is not working fine, even the control is not going to this method.
function checkboxValue(col, row){
//Here my code is comes up
if (this.getCellData(14, row) == 1){ // @Ack column
return true;
}
else {
return false;
}
}
I have one more doubt.
What is the difference between new AW.UI.Checkbox & new AW.Templates.Checkbox
If we use new AW.UI.Checkbox i am not able to use checkboxes and images in the same column.
If we use new AW.Templates.Checkbox i am not able to check the check box based on my XML attribute values.
Narayana Swamy, Bangalore
Wednesday, September 5, 2007
This topic is archived.
Back to support forum
Forum search