'data from another rows/columns' can't find data
I have tried the example Alex recently gave on http://www.activewidgets.com/javascript.forum.3294.2/data-from-another-rows-columns.html 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
This also works fine. When I move this setForm function to a js file however things stop working. I get this error
I have tried to change the way I attach the function to the grid object by replacing
in the above code by
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.
var gridUsers_columns = [
"First Name","Last Name","Department","Country"
]
var gridUsers_data = [
["myfirstname","mylastname","mydepartment","mycountry"]
];
try {
var gridUsers = new Active.Controls.Grid;
gridUsers.setRowCount(1);
gridUsers.setColumnCount(4);
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);
alert(tekst);
}
gridUsers.setAction("click", setForm);
document.write(gridUsers);
}
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.
Roebie
March 15,