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

Commit 4009ed6

Browse files
Merge branch 'release/0.0.3'
2 parents 54561cc + e4a9d66 commit 4009ed6

17 files changed

+6172
-49
lines changed

Changelog.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
## 0.0.3
2+
* Specify [columns.title](https://datatables.net/reference/option/columns.title) and
3+
[columns.type](https://datatables.net/reference/option/columns.type)
4+
* Improve documentation in README
5+
16
## 0.0.2
27
* Add `.dt()` method to access the underlying DataTable object.
38
* Add readme and abbreviate the [main demo page](https://dc-js.github.io/dc.datatables.js/) so it's

README.md

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,35 @@
33
The intent of this project is to integrate the powerful UI, styling, and plugins of
44
[DataTables](https://datatables.net/) with dc.js filtered data.
55

6-
[Demo](https://dc-js.github.io/dc.datatables.js/) using the dc.js stock example, but with a
7-
DataTable to display the data in a flexible way.
6+
[Demo](https://dc-js.github.io/dc.datatables.js/) using the dc.js stock example, but displaying the
7+
data with a DataTable.
88

9-
For now the implementation is quite simple:
9+
Instead of generating an HTML table using `dc.dataTable` and then converting the DOM elements to a
10+
DataTable, use `dc.datatables.js` to import the data programmatically. This should be faster and
11+
less error-prone.
12+
13+
Implementation:
1014

1115
* `.render()` creates the DataTable object and maps
1216
[columns](https://dc-js.github.io/dc.js/docs/html/dc.dataTable.html#columns__anchor) defined
1317
similar to those in `dc.dataTable`
1418
* `.redraw()` pulls all the data (`.top(Infinity`) from the dimension and puts it into the
15-
DataTable.
19+
DataTable using [rows.add()](https://datatables.net/reference/api/rows.add())
1620
* `.dt()` fetches the underlying DataTable object for further customization.
1721

18-
This method is much faster and more reliable than the old method of generating an HTML table using
19-
`dc.dataTable` and then converting the DOM elements to a DataTable.
22+
For control over column formatting and behavior, use the object form of columns
23+
24+
* [columns.type](https://datatables.net/reference/option/columns.type), used for sorting, is 'num'
25+
by default; use `type` to override this
26+
* [columns.name](https://datatables.net/reference/option/columns.name), used as a unique id, is read
27+
from the `label`
28+
* [columns.title](https://datatables.net/reference/option/columns.title), used to provide heading
29+
text, is read from the `label` and capitalized
30+
* [columns.render](https://datatables.net/reference/option/columns.render), used to fetch and format
31+
the data, uses the function `format`
32+
33+
In limited cases, you can also use the string form of columns. This will read the field with that
34+
name, use the default numeric ordering
2035

2136
See something missing? [File an issue](https://github.com/dc-js/dc.datatables.js/issues) on this
2237
repo, or even better, fork this project and file a pull request!

dc.datatables.js

Lines changed: 6 additions & 3 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.

0 commit comments

Comments
 (0)