Working With Grid Rows and Cells
Working With Grid Rows and Cells
The grid manages a collection of
Ab.grid.Row
objects, one for each displayed grid row. You can access grid rows by index:
var rowCount = this.requestGrid.
gridRows
.getCount();
for (var i = 0; i < rowCount; i++) {
var row = this.requestGrid.
gridRows
.get(i);
...
}
You can also iterate over the collection:
this.requestGrid.
gridRows
.each(function (row) {
...
});
Properties and methods of the
Ab.grid.Row object:
Property/Method | Description | Parameters |
---|---|---|
panel | Parent grid panel reference. | |
actions |
Ext.util.MixedCollection
of
Ab.view.Action
objects, one for each button or link in this row.
|
|
cells |
Ext.util.MixedCollection
of
Ab.grid.Cell
objects, one for each cell in this row.
|
|
dom |
This row DOM element (
<tr>
) reference.
|
|
getRecord() |
Returns
Ab.data.Record
object containing all row field values as JavaScript objects.
|
|
select(selected) | Selects or unselects this row. |
selected
:
true
to select,
false
to unselect (optional, defaults to
true
)
|
unselect() | Unselects this row. | |
isSelected() |
Returns
true
if this row is selected.
|
If the grid has fields with
controlType="button"
or
controlType="link"
, each
Ab.grid.Row
object will have a collection of
Ab.view.Action
objects, one for each button or link in that grid row. If the corresponding field element in AXVW has an id attribute, you can access the corresponding action within the row's collection by that id:
var action = row.actions.get('approve');
action.enable(false);
You can attach event handlers to per-row action buttons or links:
requestGrid_onApprove: function(row, action) {
var request = row.getRecord();
request.setValue('wr.status', 'Approved');
this.requestDataSource.saveRecord(request);
}
The event handler name should match the
panelId_onFieldId
pattern in order to be auto-wired. The first parameter (
row
) is the
Ab.grid.Row
object for the grid row on which the user clicked, and the second parameter (
action
) is the
Ab.view.Action
object for the button or link.
Each
Ab.grid.Row
object manages a collection of
Ab.grid.Cell
objects, one for each cell displayed in the row. You can access cells by index:
var cellCount = row.
cells
.getCount();
for (var i = 0; i < cellCount; i++) {
var cell = row.
cells
.get(i);
...
}
You can also iterate over the collection:
row.
cells
.each(function (cell) {
...
});
Properties and methods of the
Ab.grid.Cell
object:
Property/Method | Description | Parameters |
---|---|---|
row |
Parent
Ab.grid.Row
object reference.
|
|
column |
Parent
Ab.grid.Column
object reference.
|
|
dom |
This cell DOM element (
<td>
) reference.
|
|
getId() | Returns cell column id as defined in AXVW. |