SMART datagrid v.1 > Classes > GridBase

[ grids ver.1.3.8]   Back  Forward

DataLudi.GridBase.getFieldValues  method

Get the value of field which has been specified by parameter field from each row and return as array form. 

In parameter field, it will specify the name of the corresponding field or field Index, or directly specify column object. And, it can also specify the rows which will get the value in row

function getFieldValues (field: String|Index|DataColumn, rows: [Integer|GridRow]): [*];
Returns
[*]
Parameters
field - String|Index|DataColumn. required.
The name or index of data field which will get the value.
You can also specify column object. v 1.3.8
rows - [Integer|GridRow].
If do not specify, it will be the entire rows of grid. The row index or array of row object which will get the value. v 1.3.8
Code -1
    var column = grid.getColumn(0);
    var fieldName = column.dataFieldName();
    var values = grid.getFieldValues(fieldName);
    for (var i = 0; i < values.length; i++) {
        console.log(values[i]);
    }
Code -2
    var col = grid.columnByName('addr');
    var rows = grid.getSelectedRows();
    if (col && rows && rows.length) {
        var vals = grid.getFieldValues(col, rows);
        for (var i = 0; i < vals.length; i++) {
            console.log(vals[i]);
        }
    }
See Also
getAllRows
getColumn
DataColumn.dataFieldName
DataField
Examples
Row Model