-
Notifications
You must be signed in to change notification settings - Fork 132
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Tables do not support searching and sorting The behaviour can be improved to allow searching and sorting which are common use cases of tables Let’s add the dataTable plugin to enable these features
- Loading branch information
Showing
137 changed files
with
7,822 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
### Plugin: DataTable | ||
|
||
The [DataTable](https://datatables.net) plugin enhances the functionality of tables in your MarkBind site by integrating the DataTables library. It allows you to add searching and sorting capabilities to your tables with minimal configuration. The necessary CSS and JavaScript files are already included in the project, so no additional CDN or plugin context configuration is required. | ||
|
||
To enable this plugin, simply add `dataTable` to your site's plugins: | ||
|
||
```js {heading="site.json"} | ||
{ | ||
... | ||
"plugins": [ | ||
"dataTable" | ||
] | ||
} | ||
``` | ||
|
||
To create a table with DataTable features, use one of the following syntaxes: | ||
|
||
{{ icon_example }} Sortable Table: | ||
|
||
<include src="codeAndOutput.md" boilerplate > | ||
<variable name="highlightStyle">html</variable> | ||
<variable name="code"> | ||
<d-table sortable> | ||
| Product | Price | Quantity | | ||
|-----------|-------|----------| | ||
| Apple | $0.50 | 100 | | ||
| Banana | $0.75 | 50 | | ||
| Orange | $0.60 | 75 | | ||
</d-table> | ||
</variable> | ||
</include> | ||
|
||
{{ icon_example }} Searchable Table: | ||
|
||
<include src="codeAndOutput.md" boilerplate > | ||
<variable name="highlightStyle">html</variable> | ||
<variable name="code"> | ||
<d-table searchable> | ||
| Book Title | Author | Year Published | | ||
|---------------------------|------------------|----------------| | ||
| To Kill a Mockingbird | Harper Lee | 1960 | | ||
| 1984 | George Orwell | 1949 | | ||
| Pride and Prejudice | Jane Austen | 1813 | | ||
| The Great Gatsby | F. Scott Fitzgerald | 1925 | | ||
</d-table> | ||
</variable> | ||
</include> | ||
|
||
{{ icon_example }} Sortable and Searchable Table: | ||
|
||
<include src="codeAndOutput.md" boilerplate > | ||
<variable name="highlightStyle">html</variable> | ||
<variable name="code"> | ||
<d-table sortable searchable> | ||
| City | Country | Population | | ||
|-------------|-----------|------------| | ||
| New York | USA | 8,336,817 | | ||
| London | UK | 9,002,488 | | ||
| Paris | France | 2,161,063 | | ||
| Tokyo | Japan | 13,960,236 | | ||
| Sydney | Australia | 5,367,206 | | ||
</d-table> | ||
</variable> | ||
</include> | ||
|
||
The DataTable plugin automatically renders the table with the specified features based on the presence of the `sortable` and `searchable` attributes in the `<d-table>` tag. You can use either one or both attributes to control the desired functionality for each table. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
packages/cli/test/functional/test_site_table_plugin/_markbind/layouts/default.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<header> | ||
|
||
</header> | ||
|
||
<div id="flex-body"> | ||
<div id="content-wrapper"> | ||
{{ content }} | ||
</div> | ||
<scroll-top-button></scroll-top-button> | ||
</div> | ||
|
||
<footer> | ||
|
||
</footer> |
Oops, something went wrong.