fin-hypergrid
Advanced tools
Comparing version 1.0.1 to 1.0.2
@@ -1,19 +0,114 @@ | ||
This document describes the Cell Editor interface. This information allows the application developer to create custom cell editors. | ||
# P R E L I M I N A R Y D O C U M E N T A T I O N | ||
*THIS DOCUMENT IS INCOMPLETE BUT OFFERED AS IS IN LIEU OF NOTHING.<br>NEXT UPDATE PLANNED FOR EOD 5/16/2016.* | ||
This document describes the Cell Editor interface. This information is useful to the application developer to better understand what cell editors are, how to use them, and how to create custom cell editors. | ||
### What is a cell editor? | ||
Certain cells in the grid can be edited while others cannot. Specifically, filter cells (the cells below the column headers) and data cells are editable; column and row headers, drill-downs, and top and bottom column total cellss cannot. | ||
A cell editor is graphical user interface overlaid on top of the grid that permits the user to edit the value in a particular grid cell. | ||
Cell editors can take any form. The basic cell editors are simple text input boxes. Cell editors know how to format the raw datum similar to the way it is presented in the grid; they also know how to "de-format" the data back into it's "raw" (primitive) form before storing it back into the data model. | ||
Certain kinds of grid cells can be made _editable_ (can make use of a cell editor), while others cannot: | ||
#### Starting editing | ||
Kind of cell | Can use a<br>cell editor | ||
------------------ | :---: | ||
Column header | no | ||
*Column filter* | *yes* | ||
Row handle | no | ||
Tree (drill-down) | no | ||
*Data* | *yes* | ||
Top & bottom total | no | ||
Furthermore, to actually be editable by the user, the cell must have a cell editor associated with it. (See _Associating a cell editor,_ below.) | ||
The user initiates cell editing on a filter cell with a single (or double) mouse click; or on a data cell with a double mouse click. An input control appears positioned precisely over the cell. The user interacts with the control to change the data in the cell. | ||
#### Beginning editing | ||
#### Ending editing | ||
The user initiates cell editing on a filter cell with a single (or double) mouse click; or on a data cell with a double mouse click. | ||
The new value is accepted by pressing the Enter (aka Return) key, the Tab key, or any of the four arrow keys on the keyboard; or by "clicking away" (clicking outside of) the control (including initiating editing on another cell). | ||
Providing the cell has a cell editor associated with it, an input control appears positioned precisely over the cell. The user interacts with the control to change the data in the cell. | ||
#### Concluding editing | ||
The new value is accepted by pressing the *_enter_* (aka *_return_*) key, the *_tab_* key, or any of the four arrow keys on the keyboard; or by "clicking away" (clicking outside of) the control (including initiating editing on another cell). | ||
#### Aborting editing | ||
The edit can be aborted by pressing the ESC (aka "escape") key on the keyboard; or by scrolling the grid via the mouse-wheel (or equivalent trackpad gesture). | ||
The edit can be aborted by pressing the *_esc_* ("escape") key on the keyboard; or by scrolling the grid via the mouse-wheel or trackpad gesture. | ||
### Associating a cell editor with a cell | ||
*Column filter cells* are automatically associated with the `FilterBox` cell editor, although this can be overridden. (The only practical override for a filter cell editor would probably be no editor at all, should you want to suppress filter cell editing on a column.) | ||
*Data cells* may be associated with cell editors _declaratively_ or _programmatically_. Both these methods are explained below. Note that a declaratively association can be overridden programmatically. | ||
Failure to associate a cell editor with a data cell means that the cell will not be editable. | ||
#### Declarative cell editor association | ||
*Definition.* By _declarative,_ we mean statements involving JavaScript object literals. Although technically such literals are executed at run-time, they mimic compile-time literal (constant) _declarations_ in other programming languages. These object literals supply property values to Hypergrid's various _set properties_ methods. | ||
*String referects.* Cell editor references in these declarations are always given in string form. That is, rather than a direct reference to a cell editor "class," we use a string containing the name of the constructor function. This facilitates persisting declarative data because such references are pre-_stringified._ It also allows format names to be used to reference cell editors (more on this below). | ||
NOTE: Cell editor string references are _case insensitive._ For example, `'textfield'` and `'TextField'` both refer to the `Textfield` cell editor. While this may help simplify things for the application developer, the real reason for this relaxation in the naming rules is, again, to facilitate the use of format names to refer to cell editors. | ||
For declarative cell editor association, there are two such properties of interest, `format` and `editor`. A simple algorithm (in `DataModel.prototype.getCellEditorAt`) searches for a cell editor name as follows: | ||
1. Cell property `editor`; _if undefined, then..._ | ||
2. Column property `editor`; _if undefined, then..._ | ||
3. Grid property `editor`; _if undefined, then..._ | ||
4. Cell property `format`; _if undefined, then..._ | ||
5. Column property `format`; _if undefined, then..._ | ||
6. Grid property `format`; _if undefined, then..._ | ||
7. Cell editor is undefined. | ||
If a cell editor value could not be determnined, it remains `undefined` and the cell will be _non-editable..._ Unless, that is, a cell editor is associated programmatically at run-time, as described in the next section. | ||
#### Programmatic cell editor association | ||
This data model's `getCellEditorAt` method is called when the user attempts to open a cell editor. For programmatic cell editor association, override it: | ||
```javascript | ||
yourGrid.behavior.dataModel.getCellEditorAt = function(x, y) { | ||
// required: decide which cell editor to use | ||
var Constructor; | ||
switch (x) { | ||
case idx.BIRTH_WEIGHT: | ||
Constructor = metricWeightCellEditor; | ||
default: | ||
} | ||
// required: instantiate a new cell editor | ||
var cellEditor = new cellEditors(this.grid); | ||
// optional: set properties | ||
cellEditor.property = value; | ||
// optional: set container element's attributes | ||
if (new Date().getMonth() === 12 - 1) { | ||
cellEditor.el.classList.add('candycane'); | ||
} | ||
// optional: set input element's attributes | ||
cellEditor.input.setAttribute('maxlength', '5'); | ||
return cellEditor; // reaquired | ||
}; | ||
``` | ||
As you can see, the requirements for any implementation of this method is to decide upon a cell editor, instantiate it, and return the new instance. | ||
`getCellEditorAt` is called with the cell coordinates: | ||
Parameter | Description | ||
`x` | The _untranslated_ column index. The _translated" means that this does not refer to the column currently visible in the grid at this position. Columns can be hidden or re-ordered via the UI or programmatically. which is its position in `yourGrid.behavior.columns` (built from `yourGrid.behavior.dataSource.source.fields`). This means that which means that the column coordinate | ||
__________________ | ||
<sup>*</sup> Alternatively, you can create a custom class extended from `DataModel` with your your implementation of `getCellEditorAt` in its prototype; but you will have to overload `yourGrid.behavior.getNewDataModel` in order to use it. | ||
### What's in the box? | ||
@@ -46,5 +141,5 @@ | ||
File | Object | Description | ||
---- | ------ | ----------- | ||
ComboBox.js | ComboBox | Combines a text box (`<input type="text">` UI control) with a drop-down (`<select>...</select>` UI control) which appears when the user clicks an arrow icon (`▾`). The user may type into the text box and/or select an item from the drop-down. | ||
File | Object | Markup | Description | ||
---- | ------ | ------ | ----------- | ||
ComboBox.js | ComboBox | `<div>`...`</div>` | Combines a text box (`<input type="text">` UI control) with a drop-down (`<select>...</select>` UI control) which appears when the user clicks an arrow icon (`▾`). The user may type into the text box and/or select an item from the drop-down. | ||
@@ -51,0 +146,0 @@ ### Setting cell editor attributes |
{ | ||
"name": "fin-hypergrid", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "Canvas-based high-performance spreadsheet", | ||
@@ -5,0 +5,0 @@ "repository": { |
@@ -6,8 +6,8 @@ **fin-hypergrid** is an ultra-fast HTML5 grid presentation layer, achieving its speed by rendering (in a canvas tag) only the currently visible portion of your (virtual) grid, thus avoiding the latency and life-cycle issues of building, walking, and maintaining a complex DOM structure. | ||
This version replaces last year's [prototype version](https://github.com/openfin/fin-hypergrid/tree/polymer-prototype), which was built around Polymer. It is now completely "de-polymerized" and is being made available as: | ||
* An [npm module](https://www.npmjs.com/package/fin-hypergrid) on npmpjs.org for use with browserify. | ||
* JavaScript files ([dev](https://openfin.github.io/fin-hypergrid/build/fin-hypergrid.js), [min](https://openfin.github.io/fin-hypergrid/build/fin-hypergrid.min.js)) on github.io for reference in a `<script>` tag. | ||
* An [npm module](https://www.npmjs.com/package/fin-hypergrid) for use with browserify. | ||
* A single JavaScript file [fin-hypergrid.js](https://openfin.github.io/fin-hypergrid/build/fin-hypergrid.js) you can reference in a `<script>` tag. | ||
### Demos | ||
See the version 1.0 demo [here](https://openfin.github.io/fin-hypergrid). | ||
See the version 1.0 [demo](https://openfin.github.io/fin-hypergrid/demo/index.html). | ||
@@ -39,2 +39,2 @@ The prototype version's [demos](http://openfin.github.io/fin-hypergrid/components/fin-hypergrid/demo.html) had some nice applications you may wish to look at for inspiration of what you can do with hypergrid and to give you some idea of the speed and responsiveness of the engine. | ||
(Cell editor information can be found [here](http://openfin.github.io/fin-hypergrid/doc/cell-editors.html).) | ||
(Cell editor information can be found [here](http://openfin.github.io/fin-hypergrid/doc/tutorial-cell-editors.html).) |
@@ -135,24 +135,26 @@ /* eslint-env browser */ | ||
this.columns[-1] = this.newColumn(-1, ''); | ||
this.columns[-2] = this.newColumn(-2, 'Tree'); | ||
this.allColumns[-1] = this.columns[-1]; | ||
this.allColumns[-2] = this.columns[-2]; | ||
this.allColumns[-1] = this.columns[-1] = this.newColumn(-1); | ||
this.allColumns[-2] = this.columns[-2] = this.newColumn(-2); | ||
}, | ||
getColumn: function(x) { | ||
getVisibleColumn: function(x) { | ||
return this.columns[x]; | ||
}, | ||
getColumn: function(x) { | ||
return this.allColumns[x]; | ||
}, | ||
getColumnId: function(x) { | ||
return this.getColumn(x).getHeader(); | ||
return this.getVisibleColumn(x).getHeader(); | ||
}, | ||
newColumn: function(index, label) { | ||
var properties = this.createColumnProperties(); | ||
this.getPrivateState().columnProperties[index] = properties; | ||
return new Column(this, index, label); | ||
newColumn: function(options) { | ||
var column = new Column(this, options); | ||
this.getPrivateState().columnProperties[column.index] = this.createColumnProperties(); | ||
return column; | ||
}, | ||
addColumn: function(index, label) { | ||
var column = this.newColumn(index, label); | ||
addColumn: function(options) { | ||
var column = this.newColumn(options); | ||
this.columns.push(column); | ||
@@ -487,3 +489,3 @@ this.allColumns.push(column); | ||
getColumnWidth: function(x) { | ||
var column = this.getColumn(x); | ||
var column = this.getVisibleColumn(x); | ||
if (!column) { | ||
@@ -497,3 +499,3 @@ return this.resolveProperty('defaultColumnWidth'); | ||
setColumnWidth: function(x, width) { | ||
this.getColumn(x).setWidth(width); | ||
this.getVisibleColumn(x).setWidth(width); | ||
this.stateChanged(); | ||
@@ -511,3 +513,3 @@ }, | ||
getCellRenderer: function(config, x, y) { | ||
return this.getColumn(x).getCellRenderer(config, y); | ||
return this.getVisibleColumn(x).getCellRenderer(config, y); | ||
}, | ||
@@ -599,3 +601,3 @@ | ||
if (!memento.columnIndexes) { | ||
var fields = this.getFields(); | ||
var fields = this.dataModel.getFields(); | ||
memento.columnIndexes = []; | ||
@@ -721,3 +723,3 @@ for (var i = 0; i < fields.length; i++) { | ||
getValue: function(x, y) { | ||
var column = this.getColumn(x); | ||
var column = this.getVisibleColumn(x); | ||
return column && column.getValue(y); | ||
@@ -727,3 +729,3 @@ }, | ||
getUnfilteredValue: function(x, y) { | ||
var column = this.getColumn(x); | ||
var column = this.getVisibleColumn(x); | ||
return column && column.getUnfilteredValue(y); | ||
@@ -741,3 +743,3 @@ }, | ||
setValue: function(x, y, value) { | ||
var column = this.getColumn(x); | ||
var column = this.getVisibleColumn(x); | ||
return column && column.setValue(y, value); | ||
@@ -1183,7 +1185,7 @@ }, | ||
* @memberOf Behavior.prototype | ||
* @return {string} The field at `colIndex`. | ||
* @param {number} colIndex - the column index of interest | ||
* @return {string} The field at `visibleColumnIndex`. | ||
* @param {number} visibleColumnIndex - the column index of interest | ||
*/ | ||
getField: function(colIndex) { | ||
return colIndex === -1 ? 'tree' : this.getColumn(colIndex).getField(); | ||
getVisibleColumnName: function(visibleColumnIndex) { | ||
return this.getVisibleColumn(visibleColumnIndex).name; | ||
}, | ||
@@ -1193,7 +1195,7 @@ | ||
* @memberOf Behavior.prototype | ||
* @return {string} The column heading at `colIndex'. | ||
* @param {number} colIndex - the column index of interest | ||
* @return {string} The column heading at `visibleColumnIndex'. | ||
* @param {number} visibleColumnIndex - the column index of interest | ||
*/ | ||
getHeader: function(colIndex) { | ||
return colIndex === -1 ? 'Tree' : this.getColumn(colIndex).getHeader(); | ||
getHeader: function(visibleColumnIndex) { | ||
return this.getVisibleColumn(visibleColumnIndex).header; | ||
}, | ||
@@ -1230,4 +1232,4 @@ | ||
id: i, | ||
label: this.getHeader(i), | ||
field: this.getField(i) | ||
header: this.getHeader(i), | ||
field: this.getVisibleColumnName(i) | ||
}); | ||
@@ -1369,2 +1371,3 @@ } | ||
/** | ||
* Number of _visible_ columns. | ||
* @memberOf Behavior.prototype | ||
@@ -1430,3 +1433,3 @@ * @return {number} The total number of columns. | ||
? this.grid.createCellEditor('filterbox') | ||
: this.getColumn(x).getCellEditorAt(y); | ||
: this.getVisibleColumn(x).getCellEditorAt(y); | ||
}, | ||
@@ -1440,3 +1443,3 @@ | ||
toggleSort: function(x, keys) { | ||
this.getColumn(x).toggleSort(keys); | ||
this.getVisibleColumn(x).toggleSort(keys); | ||
}, | ||
@@ -1536,3 +1539,3 @@ | ||
convertViewPointToDataPoint: function(viewPoint) { | ||
var newX = this.getColumn(viewPoint.x).index; | ||
var newX = this.getVisibleColumn(viewPoint.x).index; | ||
var newPoint = this.grid.newPoint(newX, viewPoint.y); | ||
@@ -1573,10 +1576,2 @@ return newPoint; | ||
getFieldName: function(index) { | ||
return this.getFields()[index]; | ||
}, | ||
getColumnIndex: function(fieldName) { | ||
return this.getFields().indexOf(fieldName); | ||
}, | ||
getComputedRow: function(y) { | ||
@@ -1583,0 +1578,0 @@ return this.dataModel.getComputedRow(y); |
@@ -7,15 +7,56 @@ /* eslint-env browser */ | ||
var localization = require('../lib/localization'); | ||
var deprecated = require('../lib/deprecated'); | ||
/** | ||
var propertyNames = [ | ||
'index', | ||
'name', | ||
'header', | ||
'type' | ||
]; | ||
/** @summary Create a new `Column` object. | ||
* @constructor | ||
* @param behavior | ||
* @param index | ||
* @param label | ||
* @param {number|object} indexOrOptions - If a number, shorthand for `options.index`. | ||
* | ||
* For positive values of `options.index`, see {@link Column#initialize|initialize}. Note that for new columns, you must supply either `index` or `name`. If you supply both, they must match the definitiion in data model's `fields` list. | ||
* | ||
* Negative values are special cases: | ||
* `index` | Meaning | ||
* :-----: | -------- | ||
* -1 | Row header column | ||
* -2 | Tree (drill-down) column | ||
* | ||
* | ||
*/ | ||
function Column(behavior, index, label) { | ||
function Column(behavior, indexOrOptions) { | ||
this.behavior = behavior; | ||
this.dataModel = behavior.dataModel; | ||
this.index = index; | ||
this.label = label; | ||
this.cellProperties = []; | ||
var options = typeof indexOrOptions === 'object' ? indexOrOptions : { index: indexOrOptions }, | ||
index = options.index; | ||
switch (index) { | ||
case -1: | ||
this.index = index; | ||
this.name = ''; | ||
this.header = ''; | ||
break; | ||
case -2: | ||
this.index = index; | ||
this.name = 'tree'; | ||
this.header = 'Tree'; | ||
break; | ||
default: | ||
if (index < 0) { | ||
throw '`index` out of range'; | ||
} else { | ||
this.set(options); | ||
} | ||
} | ||
} | ||
@@ -26,2 +67,35 @@ | ||
/** @summary Set or reset the properties of a column object. | ||
* @desc When (re)setting a column object, the object must end up with fully defined `index` and `name` properties. If one is missing it will be derived from the data model's `fields` list. | ||
* Note: These properties of the column object should not be confused with the members of the columnProperties object which supports grid render and is something else entirely. | ||
* @param {object} options - Required because you must supply at least `index` or `name`. | ||
* @param {object} [options.index] | ||
* @param {object} [options.name] | ||
* @param {object} [options.header] | ||
* @param {object} [options.type] | ||
*/ | ||
set: function(options) { | ||
var column = this; | ||
propertyNames.forEach(function(option) { | ||
if (option in options) { | ||
column[option] = options[option]; | ||
} | ||
}); | ||
var fields = this.dataModel.getFields(); | ||
if (column.name === undefined) { | ||
column.name = fields[column.index]; | ||
} else if (column.index === undefined) { | ||
column.index = fields.indexOf(column.name); | ||
} | ||
if (column.index === undefined) { | ||
throw 'column.index not defined'; | ||
} else if (column.name === undefined) { | ||
throw 'column.name not defined'; | ||
} else if (fields[column.index] !== column.name) { | ||
throw 'Expected to find `column.name` in position `column.index` in data model\'s fields list.'; | ||
} | ||
}, | ||
getUnfilteredValue: function(y) { | ||
@@ -157,8 +231,12 @@ return this.dataModel.getUnfilteredValue(this.index, y); | ||
/** @deprecated Use `.header` property instead. | ||
*/ | ||
getHeader: function() { | ||
return this.label; | ||
return deprecated.call(this, 'header', { since: '1.0' }); | ||
}, | ||
/** @deprecated Use `.name` property instead. | ||
*/ | ||
getField: function() { | ||
return this.dataModel.getFields()[this.index]; | ||
return deprecated.call(this, 'name', { since: '1.0', getterName: 'getField' }); | ||
}, | ||
@@ -165,0 +243,0 @@ |
@@ -55,7 +55,7 @@ 'use strict'; | ||
this.clearColumns(); | ||
for (var i = 0; i < columnCount; i++) { | ||
var header = headers[i]; | ||
var column = this.addColumn(i, header); | ||
for (var index = 0; index < columnCount; index++) { | ||
var header = headers[index]; | ||
var column = this.addColumn({ index: index, header: header }); | ||
var properties = column.getProperties(); | ||
properties.field = fields[i]; | ||
properties.field = fields[index]; | ||
properties.header = header; | ||
@@ -85,18 +85,2 @@ properties.complexFilter = null; | ||
* @memberOf behaviors.JSON.prototype | ||
* @desc * @returns {string[]} The header labels. | ||
*/ | ||
getHeaders: function() { | ||
return this.dataModel.getHeaders(); | ||
}, | ||
/** | ||
* @memberOf behaviors.JSON.prototype | ||
* @return {string} The field at `colIndex`. | ||
* @param {number} colIndex - the column index of interest | ||
*/ | ||
getField: function(colIndex) { | ||
return colIndex === -1 ? 'tree' : this.getColumnFromFullList(colIndex).getField(); | ||
}, | ||
/** | ||
* @memberOf behaviors.JSON.prototype | ||
* @description Set the fields array. | ||
@@ -114,16 +98,6 @@ * @param {string[]} fieldNames - The field names. | ||
* @memberOf behaviors.JSON.prototype | ||
* @description Get the field names. | ||
* @returns {string[]} | ||
*/ | ||
getFields: function() { | ||
return this.dataModel.getFields(); | ||
}, | ||
/** | ||
* @memberOf behaviors.JSON.prototype | ||
* @description Set the data field. | ||
* @param {object[]} objects - An array of uniform objects, each being a row in the grid. | ||
* @param {FilterTree} [filter] | ||
* @param {object[]} dataRows - An array of uniform objects backing the rows in the grid. | ||
*/ | ||
setData: function(dataRows, filter) { | ||
setData: function(dataRows) { | ||
this.dataModel.setData(dataRows); | ||
@@ -142,3 +116,3 @@ this.createColumns(); | ||
setTimeout(function() { | ||
self.allColumns[-1].checkColumnAutosizing(true); | ||
self.getColumn(-1).checkColumnAutosizing(true); | ||
self.changed(); | ||
@@ -190,5 +164,5 @@ }); | ||
* myJsonBehavior.setColumns([ | ||
* { title: 'Stock Name', field: 'short_description' }, | ||
* { title: 'Status', field: 'trading_phase' }, | ||
* { title: 'Reference Price', field: 'reference_price' } | ||
* { header: 'Stock Name', name: 'short_description' }, | ||
* { header: 'Status', name: 'trading_phase' }, | ||
* { header: 'Reference Price', name: 'reference_price' } | ||
* ]); | ||
@@ -199,3 +173,3 @@ * ``` | ||
setColumns: function(columnDefinitions) { | ||
this.dataModel.setColumns(columnDefinitions); | ||
this.dataModel.setColumns(columnDefinitions); // TODO: this method is missing | ||
}, | ||
@@ -227,5 +201,2 @@ | ||
}, | ||
getColumnFromFullList: function(x) { | ||
return this.allColumns[x]; | ||
}, | ||
@@ -232,0 +203,0 @@ |
@@ -78,3 +78,3 @@ // ComboBox.js - A combo-box is a combination of a text-box and a drop-down. | ||
d = [], | ||
columnName = this.column.getField(), | ||
columnName = this.column.name, | ||
formatter = this.column.getFormatter(); | ||
@@ -81,0 +81,0 @@ |
@@ -33,3 +33,3 @@ /* eslint-env browser */ | ||
column = this.column = this.grid.behavior.columns[point.x], | ||
columnName = column.getField(), | ||
columnName = column.name, | ||
columnFilters = this.grid.getGlobalFilter().columnFilters, | ||
@@ -109,3 +109,3 @@ columnFilterSubtree = filter.getColumnFilter(columnName), | ||
if (index !== x) { | ||
var name = column.getField(), | ||
var name = column.name, | ||
option = new Option(name); | ||
@@ -135,3 +135,3 @@ option.title = '[' + name + ']\r"' + column.getHeader() + '"'; | ||
var filter = this.grid.getGlobalFilter(), | ||
columnName = this.column.getField(), | ||
columnName = this.column.name, | ||
columnFilterSubtree = filter.getColumnFilter(columnName); | ||
@@ -138,0 +138,0 @@ |
@@ -91,7 +91,7 @@ /** | ||
register(require('./Color')); | ||
register(require('./Date')); | ||
exports.date = register(require('./Date')); // `date` defined here for column.type fallback | ||
register(require('./FilterBox')); | ||
register(require('./Number')); | ||
exports.number = register(require('./Number')); // `number` defined here for column.type fallback | ||
register(require('./Slider')); | ||
exports.int = exports.float = register(require('./Spinner')); | ||
register(require('./Textfield')); | ||
register(require('./Spinner')); | ||
exports.string = register(require('./Textfield')); // `string` defined here for column.type fallback |
@@ -67,3 +67,3 @@ 'use strict'; | ||
* | ||
* @param {number} x - Column index in `behavior.allColumns` array. | ||
* @param {number} x - Absolute column index. | ||
* @param {number} y - Row index in `dataRows` (raw `dataSource.data`) array. | ||
@@ -74,4 +74,5 @@ * | ||
getCellEditorAt: function(x, y) { | ||
var cellProperties, columnProperties, | ||
column = this.grid.behavior.allColumns[x]; | ||
var cellProperties, | ||
columnProperties, | ||
column = this.grid.behavior.getColumn(x); | ||
@@ -82,3 +83,4 @@ return this.grid.createCellEditor( | ||
cellProperties.format || | ||
columnProperties.format | ||
columnProperties.format || | ||
column.getType() | ||
); | ||
@@ -85,0 +87,0 @@ } |
@@ -233,3 +233,3 @@ 'use strict'; | ||
//access directly because we want it ordered | ||
var column = this.grid.behavior.allColumns[colIndex]; | ||
var column = this.grid.behavior.getColumn(colIndex); | ||
if (column) { | ||
@@ -402,7 +402,5 @@ return column.getProperties(); | ||
getVisibleColumns: function() { | ||
var items = this.grid.behavior.columns; | ||
items = items.filter(function(each) { | ||
return each.label !== 'Tree'; | ||
return this.grid.behavior.columns.filter(function(column) { | ||
return column.name !== 'tree'; | ||
}); | ||
return items; | ||
}, | ||
@@ -424,3 +422,3 @@ | ||
hidden.sort(function(a, b) { | ||
return a.label < b.label; | ||
return a.header < b.header; | ||
}); | ||
@@ -912,3 +910,3 @@ return hidden; | ||
// was previously returning, for each column in this.getVisibleColumns(): | ||
// [ { column: column.label, format: 'complex' or column.getProperties().format }, ... ] | ||
// [ { column: column.header, format: 'complex' or column.getProperties().format }, ... ] | ||
@@ -915,0 +913,0 @@ |
@@ -8,3 +8,3 @@ 'use strict'; | ||
* @summary Build, organize, and sort a column schema list from a list of columns. | ||
* @desc FilterTree requires a column schema. As a fallback when you don't have a column schema of your own, the string array returned by behavior.getFields() would work as is. This factory object will do a little better than that, taking Hypergrid's column array and creating a more textured column schema, including column aliases and types. | ||
* @desc FilterTree requires a column schema. As a fallback when you don't have a column schema of your own, the string array returned by behavior.dataModel.getFields() would work as is. This factory object will do a little better than that, taking Hypergrid's column array and creating a more textured column schema, including column aliases and types. | ||
* | ||
@@ -20,4 +20,4 @@ * CAVEAT: Set up the schema completely before instantiating your filter state. Filter-tree uses the schema (in part) to generate column selection drop-downs as part of its "query builder" UI. Note that the UI is *not* automatically updated if you change the schema later. | ||
return { | ||
name: column.getField(), | ||
alias: column.getHeader(), | ||
name: column.name, | ||
alias: column.header, | ||
type: column.getType() | ||
@@ -24,0 +24,0 @@ }; |
@@ -466,3 +466,3 @@ 'use strict'; | ||
column.type = columnSchema.type || column.type; | ||
column.label = columnSchema.alias || column.label; | ||
column.header = columnSchema.alias || column.header; | ||
}); | ||
@@ -469,0 +469,0 @@ } |
@@ -11,2 +11,10 @@ 'use strict'; | ||
/** | ||
* | ||
* @param dotProps | ||
* @param {object} [options] | ||
* @param {object} [options.asOfVersion] | ||
* @param {object} [options.getterName] - If omitted, final name in dotProps will be used prefixed with 'get'. | ||
* @returns {deprecated} | ||
*/ | ||
var deprecated = function(dotProps, options) { | ||
@@ -19,3 +27,3 @@ var chain = dotProps.split('.'), | ||
method = 'get' + method[0].toUpperCase() + method.substr(1); | ||
method = options && options.getterName || 'get' + method[0].toUpperCase() + method.substr(1); | ||
@@ -22,0 +30,0 @@ warning = '.' + method + '() method is deprecated'; |
@@ -439,3 +439,3 @@ /* eslint-env browser */ | ||
var column = behavior.getColumn(c); | ||
var column = behavior.getVisibleColumn(c); | ||
if (column) { | ||
@@ -1033,3 +1033,3 @@ translatedIndex = column.index; | ||
if (c === -1) { | ||
if (r === 0) { // header label row gets "master" checkbox | ||
if (r === 0) { // header row gets "master" checkbox | ||
cellProperties.value = [images.checkbox(areAllRowsSelected), '', null]; | ||
@@ -1071,3 +1071,3 @@ } else if (isFilterRow) { // no checkbox but show filter icon | ||
var cell = behavior.getCellRenderer(cellProperties, c, r); | ||
var overrides = behavior.getCellProperties(behavior.getColumn(c).index, r); | ||
var overrides = behavior.getCellProperties(behavior.getVisibleColumn(c).index, r); | ||
@@ -1074,0 +1074,0 @@ //declarative cell properties |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
691807
83
17555