How can get back all data of a row in variable
Hi,
I need to do this to build a external command which will be execute later.
I'd like to have an array with all data of each cells of a row.
How can do this ?
Thank's.
Ps: Sorry for my english, it'is not my usual language !!
Stephane
September 10,
Here is the Template I wrote to Solve this problem.
My.Templates.RowAware = Active.System.Template.subclass();
My.Templates.RowAware.create = function(){
var obj = this.prototype;
var _super = this.superclass.prototype;
obj.__templateText = "{$}";
obj.getTemplateText = function(){ return this.__templateText; }
obj.setTemplateText = function( t ){ this.__templateText = t; }
obj.setContent("html", function() {
return this.resolveColumns( this.__templateText );
});
obj.resolveColumns = function( str ) {
var r = this.getRowProperty("index");
var c = this.getColumnProperty("index");
var t = this.getItemProperty( "text" );
if (this.$owner) {
var results, row = this.$owner;
var pattern = /\{(\d+)\}/;
while (results = pattern.exec(str)) {
var colIndex = results[1];
var colValue = this.getColumnValue( colIndex );
if(!colValue) colValue = "";
str = str.replace( results[0], colValue );
}
}
str = str.replace(/{\$}/, t);
str = str.replace(/{row}/, r).replace(/{col}/,c);
return str;
}
obj.getColumnValue = function( colIndex ) {
var v = "";
if (this.$owner) {
v = this.$owner.getDataProperty( "text", colIndex );
}
return v;
}
};
My.Templates.RowAware.create();
then you can have the value from any column in the row as part of you generated HTML for the current cell.
Eg, this creates an anchor that alerts the value of column 0 in the current row, {$} gets replaced with the current cell data value.
var t = My.Templates.RowAware();
t.setTemplateText("<a href=\"javascript:alert('{0}');\">{$}</a>");
gbegley
September 10,
Hi,
I have a problem to access the data of each cells in the selection row.
does anyone knows how to do this?
Thank
ChamRoeun
August 4,