Skip to content

Commit

Permalink
Merge pull request #734 from fin-hypergrid/develop
Browse files Browse the repository at this point in the history
merge v2.1.14 develop to master
  • Loading branch information
joneit authored Jun 25, 2018
2 parents abfca3a + c665fd2 commit a1c2dad
Show file tree
Hide file tree
Showing 34 changed files with 1,919 additions and 1,656 deletions.
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[submodule "jsdoc-template-hypergrid"]
path = jsdoc-template-hypergrid
url = https://github.com/openfin/jsdoc-template-hypergrid
url = https://github.com/fin-hypergrid/jsdoc-template-hypergrid
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ It also highlights a DOM-based custom external editor triggered via hypergrid ev
* [Roadmap](#roadmap)
* [Contributing](#contributors)

### Current Release (2.1.13 - 12 June 2018)
### Current Release (2.1.14 - 12 June 2018)

**Hypergrid 2.1.13** includes bug fixes, new features, and a couple of additional demos.
**Hypergrid 2.1.14** includes bug fixes.

_For a complete list of changes, see the [release notes](https://github.com/fin-hypergrid/core/releases)._

Expand Down Expand Up @@ -52,13 +52,13 @@ Find more information on our [testing page](TESTING.md)

Primarily our tutorials will be on the [wiki](https://github.com/fin-hypergrid/core/wiki).

We also maintain versioned [online API documentation](https://fin-hypergrid.github.io/core/2.1.13/doc/Hypergrid.html) for all public objects and modules. This documentation is necessarily an on-going work-in-progress.
We also maintain versioned [online API documentation](https://fin-hypergrid.github.io/core/2.1.14/doc/Hypergrid.html) for all public objects and modules. This documentation is necessarily an on-going work-in-progress.

(Cell editor information can be found [here](https://github.com/fin-hypergrid/core/wiki/Cell-Editors).)

(Cell Rendering information can be found [here](https://github.com/fin-hypergrid/core/wiki/Cell-Renderers).)

Hypergrid global configurations can be found [here](https://fin-hypergrid.github.io/core/2.1.13/doc/module-defaults.html).
Hypergrid global configurations can be found [here](https://fin-hypergrid.github.io/core/2.1.14/doc/module-defaults.html).

### Roadmap

Expand Down
115 changes: 115 additions & 0 deletions demo/filter-row.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" >
</head>
<body>

<script src="build/fin-hypergrid.js"></script>

<script>
window.onload = function() {
var data = [
{ symbol: 'APPL', name: 'Apple Inc.', prevclose: 93.13 },
{ symbol: 'MSFT', name: 'Microsoft Corporation', prevclose: 51.91 },
{ symbol: 'TSLA', name: 'Tesla Motors Inc.', prevclose: 196.40 },
{ symbol: 'IBM', name: 'International Business Machines Corp', prevclose: 155.35 }
];
var grid = window.grid = new fin.Hypergrid();
grid.setData(data);

fin.Hypergrid.dataModels.add('FilterSubgrid', fin.Hypergrid.dataModels.DataModel.extend({
type: 'filter',

format: 'filter', // this signals to renderer to override column localizer for these cells

initialize: function (grid) {
this.grid = grid;
},

getRow: function (y) {
return this.grid.behavior.getColumns().map(function (column) {
return column.filter || '';
});
},

getRowCount: function () {
return this.grid.properties.showFilterRow ? 1 : 0;
},

getValue: function (x, y) {
return this.grid.behavior.getColumn(x).properties.filter || '';
},

setValue: function (x, y, value) {
var column = this.grid.behavior.getColumn(x).properties.filter = value;
}
}));

// bonus feature: immediate mode filters on every keypress
grid.cellEditors.add(grid.cellEditors.get('Textfield').extend('FilterEditor', {
keyup: function (event) {
if (
!this.super.keyup.call(this, event) &&
this.grid.properties.filteringMode === 'immediate'
) {
try {
this.saveEditorValue(this.getEditorValue());
} catch (err) {
// ignore syntax errors in immediate mode
}
}
},

saveEditorValue: function(value) {
var save = !arguments.length || value !== this.initialValue;

if (save) {
this.grid.behavior.setValue(this.event, value);
this.grid.fireSyntheticFilterAppliedEvent();
}

return save;
}
}));


grid.properties.subgrids = [
'HeaderSubgrid',
'FilterSubgrid',
'data'
];
grid.properties.showFilterRow = true;

var version = grid.version.split('.');
if (
Number(version[0]) >= 2 &&
Number(version[1]) >= 1 &&
Number(version[2]) >= 14
) {
// new way
grid.properties.filterEditor = 'FilterEditor';
} else {
// old way makes works when whole grid editable...
grid.properties.editor = 'Textfield'; // must be something in order for getCellEditorAt to be called
grid.behavior.dataModel.getCellEditorAt = function(columnIndex, rowIndex, editorName, cellEvent) {
if (cellEvent.isFilterCell) {
editorName = 'FilterEditor';
}
return cellEvent.grid.cellEditors.create(editorName, cellEvent);
}
}

grid.addEventListener('fin-filter-applied', function(e) {
console.log('Filters:', this.grid.behavior.getColumns().reduce(function (obj, column) {
if (column.properties.filter) {
obj[column.name] = column.properties.filter;
}
return obj;
}, {}));
})
};
</script>

</body>
</html>
2 changes: 1 addition & 1 deletion demo/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
b = g.behavior,
m = b.dataModel;">top-level global vars</label>

<h1 style="margin:.5em; color:lightgrey">Hypergrid 2.1.13 dev testbench</h1>
<h1 style="margin:.5em; color:lightgrey">Hypergrid 2.1.14 dev testbench</h1>

<div id="tabs">
<div id="tab-dashboard">Dashboard</div>
Expand Down
2 changes: 1 addition & 1 deletion demo/multiple-grids.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<style> body > div.hypergrid-container { width: 415px; margin-right: 10px; display: inline-block }</style>
</head>
<body>
<h1 style="margin:.5em; color:lightgrey">Hypergrid 2.1.13 multiple grids demo</h1>
<h1 style="margin:.5em; color:lightgrey">Hypergrid 2.1.14 multiple grids demo</h1>

<script src="build/fin-hypergrid.js"></script>

Expand Down
29 changes: 29 additions & 0 deletions demo/over-render.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" >
</head>
<body>


<script src="build/fin-hypergrid.js"></script>

<script>
var data = [
{ symbol: 'APPL', name: 'Apple Inc.', prevclose: 93.13 },
{ symbol: 'MSFT', name: 'Microsoft Corporation', prevclose: 51.91 },
{ symbol: 'TSLA', name: 'Tesla Motors Inc.', prevclose: 196.40 },
{ symbol: 'IBM', name: 'International Business Machines Corp', prevclose: 155.35 }
];
var grid = new fin.Hypergrid();
grid.setData(data);

grid.properties.renderer = ['SimpleCell', 'Tag'];
grid.behavior.columns.prevclose.properties.tagbands = [
{ floor: 128, fillStyle: 'green' },
{ floor: 64, fillStyle: '#e0e020' },
{ floor: 0, fillStyle: 'red' }
];
</script>
</body>
</html>
2 changes: 1 addition & 1 deletion demo/row-props.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
</style>
</head>
<body>
<h1 style="margin:.5em; color:lightgrey">Hypergrid 2.1.13 performance workbench</h1>
<h1 style="margin:.5em; color:lightgrey">Hypergrid 2.1.14 performance workbench</h1>

<div id="controls" class="nowrap">
<label id="controller" title="Uncheck to hide other controls.">
Expand Down
2 changes: 1 addition & 1 deletion jsdoc-template-hypergrid
Loading

0 comments on commit a1c2dad

Please sign in to comment.