🌐 AI搜索 & 代理 主页
Skip to content
This repository was archived by the owner on Oct 21, 2023. It is now read-only.

Commit 9aaa614

Browse files
Merge branch 'release/0.0.7'
2 parents 3df3459 + 4486b00 commit 9aaa614

12 files changed

+83
-46
lines changed

AUTHORS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
Gordon Woodhull <gordon@woodhull.com>
2+
Jack Crymble <j.crymble@analyticsengines.com>

Changelog.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
## 0.0.7
2+
* Allow specifying other [datatables options](https://datatables.net/reference/option/) before rendering, by Jack Crymble ([#3](https://github.com/dc-js/dc.datatables.js/issues/3) / [#4](https://github.com/dc-js/dc.datatables.js/pull/4))
3+
14
## 0.0.6
25
* add jQuery and datatables as explicit dependencies
36

dc.datatables.js

Lines changed: 24 additions & 13 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dc.datatables.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dc.datatables.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dc.datatables.min.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "dc.datatables",
3-
"version": "0.0.6",
3+
"version": "0.0.7",
44
"license": "Apache-2.0",
55
"copyright": "2018",
66
"description": "Datatables integrated with crossfilter and dc.js",

src/datatable.js

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ dc_datatables.datatable = function(selector, chartGroup) {
33
_dt, // jquery.dataTables object
44
_root, // selected div
55
_dimension, // crossfilter dimension
6+
_options, // additional options for datatables
67
_group, _size, _columns, _sortBy, _order; // for compatibility; currently unused
78
var _dispatch = d3.dispatch('renderlet');
89

@@ -35,17 +36,20 @@ dc_datatables.datatable = function(selector, chartGroup) {
3536
table = table.enter()
3637
.append('table')
3738
.merge(table);
38-
_dt = jQuery(table.node()).DataTable({
39-
columns: _table.columns().map(function(c) {
40-
var col = {
41-
name: typeof c === 'string' ? c : c.label,
42-
type: typeof c === 'object' ? c.type : 'num',
43-
render: columnRenderer(c)
44-
};
45-
col.title = col.name.charAt(0).toUpperCase() + col.name.slice(1);
46-
return col;
47-
})
48-
});
39+
_dt = jQuery(table.node()).DataTable(
40+
Object.assign({},
41+
{
42+
columns: _table.columns().map(function(c) {
43+
var col = {
44+
name: typeof c === 'string' ? c : c.label,
45+
type: typeof c === 'object' ? c.type : 'num',
46+
render: columnRenderer(c)
47+
};
48+
col.title = col.name.charAt(0).toUpperCase() + col.name.slice(1);
49+
return col;
50+
})
51+
},
52+
_options));
4953
return _table.redraw();
5054
};
5155
_table.redraw = function() {
@@ -70,6 +74,13 @@ dc_datatables.datatable = function(selector, chartGroup) {
7074
_dt = _;
7175
return this;
7276
};
77+
_table.options = function(_) {
78+
if(!arguments.length) {
79+
return _options;
80+
}
81+
_options = _;
82+
return this;
83+
};
7384
_table.size = function(_) {
7485
if(!arguments.length) {
7586
return _size;

web/js/dc.datatables.js

Lines changed: 24 additions & 13 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)