3.0.5

The field of the grid

I set up that grid in agreement with examples and I am not getting to show the label 3 and the 4.


var grid = new AW.UI.Grid;
grid.setId("meuGrid");
grid.setCellData(function(col, row){return "cell " + col + "." + row});
grid.setColumnCount(5);
grid.setRowCount(20);
grid.setSelectionMode("single-cell"); // set selection mode to single cell
grid.refresh();

var label1 = new AW.UI.Label;
label1.setId("label1");
label1.refresh();

var label2 = new AW.UI.Label;
label2.setId("label2");
label2.refresh();

var label3 = new AW.UI.Label;
label3.setId("label3");
label3.refresh();

var label4 = new AW.UI.Label;
label4.setId("label4");
label4.refresh();

grid.onSelectedColumnsChanged = function(columnIndicesArray){
label1.setControlText("coluna: [" + columnIndicesArray + "]");
}

grid.onSelectedRowsChanged = function(rowIndicesArray){
label2.setControlText("linha: [" + rowIndicesArray + "]");
}

grid.onCurrentRowChanged = function(row, col) {
label3.setControlText("Campo 1: [" + grid.getCellText(row, col) + "]");
}

grid.onCurrentColumnChanged = function(row, col) {
label4.setControlText("Campo 2: [" + grid.getCellText(row, col) + "]");
}

Thanks.
Lourival Queiroz
August 13,
Did you insert placeholder html elements for label3 and label4?

<span id="label3"></span>
<span id="label4"></span>
Alex (ActiveWidgets)
August 14,
Yes it was put, but in the display of the field, he doesn't appear the content of the same, only the position.

Example: cell: row = 1
col = 2
value = "cell 2.1"

Running, only appears := Campo 1: [cell2.undefined]
Campo 2: [cell1.undefined]

Thanks.

Lourival.
Lourival Queiroz
August 18,
OK, now I understand. Your code uses wrong event handler arguments - onCurrentRowChanged only has row argument and onCurrentColumnChanged only has column -

grid.onCurrentRowChanged = function(row) {...}
grid.onCurrentColumnChanged = function(col) {...}
Alex (ActiveWidgets)
August 19,
The idea, was to give display of the contents of the cells of a certain row automatically, in fields type "label" or "input text" while it happens the navigation. If it possesses examples, on the same, please it could order me and to indicate the correct way to do?

Thank you for everything.
Lourival Queiroz
August 19,
grid.onCurrentRowChanged = function() {
var row = grid.getCurrentRow();
var col = grid.getCurrentColumn();
label3.setControlText("Campo 1: [" + grid.getCellText(row, col) + "]");
}

grid.onCurrentColumnChanged = function() {
var row = grid.getCurrentRow();
var col = grid.getCurrentColumn();
label4.setControlText("Campo 2: [" + grid.getCellText(row, col) + "]");
}
Alex (ActiveWidgets)
August 19,

This topic is archived.

See also:


Back to support forum