<script>
var myData = [
['hhh','HHH','111','15'],
['qq','qqq','111','16'],
['333','dsa','22.22','20'],
['_UnDefined','asdfas','23','26'],
['Some','Description of Some','1000','30']
];
var obj = new Active.Controls.Grid;
var string = new Active.Formats.String;
var date = new Active.Formats.Date;
var number = new Active.Formats.Number;
var money = new Active.Formats.Number;
obj.setStyle("border", "1px solid");
obj.setRowCount(myData.length);
obj.setColumnCount(myColumns.length);
number.setTextFormat("#");
money.setTextFormat(".###,##");
date.setDataFormat("auto");
date.setTextFormat("dd/mm/yyyy");
var formats = [string,string,money,number];
obj.setColumnText(function(i){return myColumns[i]});
obj.setDataText(function(i, j){return formats[j].dataToText(myData[i][j])});
obj.setDataValue(function(i, j){return formats[j].dataToValue(myData[i][j])});
for (var col=0; col < (myColumns.length); col++) {
obj.getTemplate("column",col).setAttribute("title", function(){return this.getProperty("item/tooltip")});
obj.defineProperty("data/tooltip", function(i, col){if (myData[i][col]==" ") { return ""; } else { return formats[col].dataToText(myData[i][col]);}});
}
obj.setAction("click", function(src){updata(formats[0].dataToText(myData[src.getRowProperty("index")][0]),formats[1].dataToText(myData[src.getRowProperty("index")][1]),formats[2].dataToValue(myData[src.getRowProperty("index")][2]),formats[3].dataToText(myData[src.getRowProperty("index")][3]))});
obj.setProperty("column/tooltip", function(i){return myColsTips[i]});
</script>
obj.setDataValue(
function(i, j){
return formats[j].dataToValue(myData[i][j]).toUpperCase();
}
);
var string = new Active.Formats.String;
string.dataToValue = function(data){
return data.toUpperCase();
}
This topic is archived.