:: Forum >>

Click on a row, and copy the second colum value of this row to the clipboard

Click on a row, and copy the second colum value of this row to the clipboard

For example
1| Test | Test2
2| peter | max

I click in "max" an becomes and I get "peter". If I click "on peter", I becomes "peter" too...
with "obj.setAction("click", function(src){editarticle.catnr.value = src.getDataProperty("text")});" I get the value where the mouse clicked. I will always the value of columm 2.

Tuesday, March 8, 2005
Alex (ActiveWidgets)
Tuesday, March 8, 2005
thx a lot!!!!!!
Wednesday, March 9, 2005
Hi Alex and Steve,
I have tried the example you refer to and it works. I would like however to move the code that shows the value to an external js file. The first step I took is to put in a seperate function
var gridUsers_columns = [
"First Name","Last Name","Department","Country"
var gridUsers_data = [
try {
var gridUsers = new Active.Controls.Grid;
gridUsers.setColumnText(function(i){return gridUsers_columns[i];});
gridUsers.setDataText(function(i,j){return gridUsers_data[i][j];});
function setForm(src) {
var rowIndex = src.getRowProperty("text");
var tekst = this.getDataProperty("text", rowIndex, 1);
gridUsers.setAction("click", setForm);
catch(error) {
//show error in another frame
parent.bottombar.write("Grid error: "; error.description);

This also works fine. When I move this setForm function to a js file however things stop working. I get this error
line 71: 'gridUsers_data[...]' is null or not an object
I have tried to change the way I attach the function to the grid object by replacing
gridUsers.setAction("click", setForm);
in the above code by
var row = new Active.Templates.Row;
row.setEvent('onclick', function(){this.action("setFormAction")});
gridUsers.setTemplate("row", row);
gridUsers.setAction("setFormAction", setForm);

because I saw some people using this technique (although I don't understand what the difference is between both). I keep getting the same error however.
The grid tool works way to good to be the cause so I must be doing something wrong. Can you tell me what ??
Thanks in advance.
Tuesday, March 15, 2005

This topic is archived.

Back to support forum

Forum search