Data Handling Question
I am attaching an XML table to a grid. My table only has 4 columns. I'd like to be able to add more columns in the grid based on values of the table. Currently the only way I have figured out how to do this is replicate the same column twice and then change the cellFormat to my own custom creation that does what I want.
In the above example, I have 2 columns (4 & 5) with the same data...one to show the data and another to show a link if the data equals a certain value. If my link is shown and I click on it I would like to fire another function but pass the data from the first column (1).
I hope I have described this so someone can help. I really appreciate anything anyone can offer here.
var string = new AW.Formats.String;
var uxdate = new AW.Formats.Date;
uxdate.setTextFormat("mmmm dd, yyyy hh:mm:ss");
uxdate.dataToValue = function(d){return Number(d)*1000};
uxdate.setErrorText("");
uxdate.setErrorValue(0);
var customdate= new AW.Formats.Number;
customdate.dataToText = function(d,i){
if (Number(d) < 1){
return "<a href=\"#\">not set</a>";
} else {
return "";
}
};
var table= new AW.XML.Table;
table.setURL("data.xml");
table.setRows("//data_feed/*");
table.setColumns(["col1", "col2", "col3", "col4", "col4"]);
table.request();
var columns = ["Col1", "Col2", "Col3", "Col4", "Col5"];
var grid= new AW.UI.Grid;
grid.setId("grid");
grid.setColumnCount(5);
grid.setHeaderText(columns);
grid.setSelectorVisible(false);
grid.setSelectionMode("single-row");
grid.setCellFormat([string, string, uxdate, uxdate, customdate]);
grid.setCellModel(table);
grid.refresh();
In the above example, I have 2 columns (4 & 5) with the same data...one to show the data and another to show a link if the data equals a certain value. If my link is shown and I click on it I would like to fire another function but pass the data from the first column (1).
I hope I have described this so someone can help. I really appreciate anything anyone can offer here.
AT
November 9,