Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migration/3.0 #459

Open
wants to merge 14 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .npm/package/.gitignore

This file was deleted.

7 changes: 0 additions & 7 deletions .npm/package/README

This file was deleted.

15 changes: 0 additions & 15 deletions .npm/package/npm-shrinkwrap.json

This file was deleted.

132 changes: 68 additions & 64 deletions .versions
Original file line number Diff line number Diff line change
@@ -1,65 +1,69 @@
aldeed:tabular@3.0.0-rc.0
allow-deny@1.1.1
aldeed:tabular@3.0.0-rc.4
allow-deny@2.0.0
anti:fake@0.4.1
babel-compiler@7.10.5
babel-runtime@1.5.1
base64@1.0.12
binary-heap@1.0.11
blaze@2.9.0
blaze-tools@1.0.10
boilerplate-generator@1.7.2
caching-compiler@1.2.2
caching-html-compiler@1.0.5
callback-hook@1.5.1
check@1.4.1
ddp@1.4.1
ddp-client@2.6.2
ddp-common@1.4.1
ddp-server@2.7.1
diff-sequence@1.1.2
dynamic-import@0.7.3
ecmascript@0.16.8
ecmascript-runtime@0.8.1
ecmascript-runtime-client@0.12.1
ecmascript-runtime-server@0.11.0
ejson@1.1.3
fetch@0.1.4
geojson-utils@1.0.11
html-tools@1.0.11
htmljs@1.2.1
id-map@1.1.1
inter-process-messaging@0.1.1
local-test:aldeed:tabular@3.0.0-rc.0
logging@1.3.4
meteor@1.11.5
minimongo@1.9.4
modern-browsers@0.1.10
modules@0.20.0
modules-runtime@0.13.1
mongo@1.16.10
mongo-decimal@0.1.3
mongo-dev-server@1.1.0
mongo-id@1.0.8
npm-mongo@4.17.2
observe-sequence@1.0.21
ordered-dict@1.1.0
promise@0.12.2
random@1.2.1
react-fast-refresh@0.2.8
reactive-dict@1.3.1
reactive-var@1.0.12
reload@1.3.1
retry@1.1.0
routepolicy@1.1.1
session@1.2.1
socket-stream-client@0.5.2
spacebars@1.0.10
spacebars-compiler@1.1.0
templating@1.1.8
templating-tools@1.1.1
tinytest@1.2.3
tracker@1.3.3
typescript@4.9.5
underscore@1.6.1
webapp@1.13.8
webapp-hashing@1.1.1
babel-compiler@7.11.0
babel-runtime@1.5.2
base64@1.0.13
binary-heap@1.0.12
blaze@3.0.0
blaze-tools@2.0.0
boilerplate-generator@2.0.0
caching-compiler@2.0.0
caching-html-compiler@2.0.0
callback-hook@1.6.0
check@1.4.2
core-runtime@1.0.0
ddp@1.4.2
ddp-client@3.0.1
ddp-common@1.4.4
ddp-server@3.0.1
diff-sequence@1.1.3
dynamic-import@0.7.4
ecmascript@0.16.9
ecmascript-runtime@0.8.2
ecmascript-runtime-client@0.12.2
ecmascript-runtime-server@0.11.1
ejson@1.1.4
facts-base@1.0.2
fetch@0.1.5
geojson-utils@1.0.12
html-tools@2.0.0
htmljs@2.0.1
id-map@1.2.0
inter-process-messaging@0.1.2
local-test:aldeed:tabular@3.0.0-rc.4
logging@1.3.5
meteor@2.0.1
minimongo@2.0.1
modern-browsers@0.1.11
modules@0.20.1
modules-runtime@0.13.2
mongo@2.0.2
mongo-decimal@0.1.4-beta300.7
mongo-dev-server@1.1.1
mongo-id@1.0.9
npm-mongo@4.17.4
observe-sequence@2.0.0
ordered-dict@1.2.0
promise@1.0.0
random@1.2.2
react-fast-refresh@0.2.9
reactive-dict@1.3.2
reactive-var@1.0.13
reload@1.3.2
retry@1.1.1
routepolicy@1.1.2
session@1.2.2
socket-stream-client@0.5.3
spacebars@2.0.0
spacebars-compiler@2.0.0
templating@1.4.4
templating-compiler@2.0.0
templating-runtime@2.0.0
templating-tools@2.0.0
tinytest@1.3.0
tracker@1.3.4
typescript@5.4.3
underscore@1.6.4
webapp@2.0.1
webapp-hashing@1.1.2
103 changes: 88 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
aldeed:tabular
=========================
# aldeed:tabular

A Meteor package that creates reactive [DataTables](http://datatables.net/) in an efficient way, allowing you to display the contents of enormous collections without impacting app performance.

Expand Down Expand Up @@ -50,14 +49,12 @@ Please open an issue if you like to help out with maintenance on this package.

<!-- END doctoc generated TOC please keep comment here to allow auto update -->

## ATTENTION: Updating to 2.0
## ATTENTION: Release v3 and datatables 2.x

Version 2.0 API is backwards compatible other than the following changes:
- Requires Meteor 1.3+
- You must explicitly import the `Tabular` object into every file where you use it. (`import Tabular from 'meteor/aldeed:tabular';`)
- You must configure the Bootstrap theme (or whatever theme you want) yourself. See [Installing and Configuring a Theme](#installing-and-configuring-a-theme)
Version 3.0 is Meteor 3 compatible but **slightly breaking** in order to support more flexibility in importing
different versions of DataTables.

This version also includes a few fixes and a few new features.
Read the respective sections on how to install/setup aldeed:tabular v3

## Features

Expand Down Expand Up @@ -87,27 +84,58 @@ This example is for the Bootstrap theme. You can use another theme package. See
First:

```bash
$ npm install --save jquery@1.12.1 datatables.net-bs
$ meteor add jquery@3.0.2
$ npm install --save jquery@latest datatables.net-bs@latest
```

Note that we install jquery@1.12.1. This needs to match the current version of jQuery included with Meteor's `jquery` package. (See the version comment in https://github.com/meteor/meteor/blob/master/packages/non-core/jquery/package.js) Otherwise, due to the `datatables.net` package depending on `jquery` NPM package, it might automatically install the latest `jquery` version, which may conflict with Bootstrap or Meteor.
> Heads up! If you want to use datatables 2.x and newer, you need to [recompile these modules](https://guide.meteor.com/using-npm-packages#recompile)
> or they will not detect the correct jquery module :-(

FOr this, open `package.json` and add to the `"meteor": {...}` the the nodes modules to recompile:

```json
{
"meteor": {
"nodeModules": {
"recompile": {
"datatables.net": ["client", "legacy"],
"datatables.net-bs": ["client", "legacy"]
}
}
}
}
```

In this example the datatables core and bootstrap are recopmiled.
While core (`datatables.net`) is always to be added, the other packages may vary, depending on your needs.

Then, somewhere in your client JavaScript:

**Datatables 1.x**

```js
import { $ } from 'meteor/jquery';
import Tabular from 'meteor/aldeeed:tabular'
import dataTablesBootstrap from 'datatables.net-bs';
import 'datatables.net-bs/css/dataTables.bootstrap.css';
// and maybe other DT imports

dataTablesBootstrap(window, $);
// and maybe other DT-init calls

// finally initializing Tabular
Tabular.init()
```

## Online Demo App
**Datatables 2.x**

View a [demonstration project on Meteorpad](http://meteorpad.com/pad/xNafF9N5XJNrFJEyG/TabularDemo).
```js
import DataTables from 'datatables.net-bs';
import 'datatables.net-bs/css/dataTables.bootstrap.css';
// and maybe other DT imports

Another example app courtesy of @AnnotatedJS:
* Hosted app: http://greatalbums.meteor.com/albums (You can sign in with email "admin@demo.com" and password "password")
* Source: https://github.com/AnnotatedJS/GreatAlbums
Tabular.init({ DataTables })
```

## Example

Expand Down Expand Up @@ -604,6 +632,10 @@ For package names for other themes, see https://datatables.net/download/npm

Once the packages are installed, you need to import them in one of your client JavaScript files:

<details>
<Summary>datatables.net 1.x</Summary>


```js
import { $ } from 'meteor/jquery';

Expand All @@ -629,6 +661,47 @@ flashExportButtons(window, $);
printButton(window, $);
```

</details>


<details>
<Summary>datatables.net >= 2.x</Summary>

You need to have Meteor [to recompile the packages](https://guide.meteor.com/using-npm-packages#recompile):

```json
{
...
"meteor": {
...
"nodeModules": {
"recompile": {
"datatables.net": ["client", "legacy"],
"datatables.net-bs": ["client", "legacy"],
"datatables.net-buttons": ["client", "legacy"],
"datatables.net-buttons-bs": ["client", "legacy"]
}
}
}
}
```

```js
// Bootstrap Theme
import 'datatables.net-bs';
import 'datatables.net-bs/css/dataTables.bootstrap.css';

// Buttons Core
import 'datatables.net-buttons-bs';
// Import whichever buttons you are using
import 'datatables.net-buttons/js/buttons.colVis.js';
import 'datatables.net-buttons/js/buttons.html5.js';
import 'datatables.net-buttons/js/buttons.flash.js';
import 'datatables.net-buttons/js/buttons.print.js';
```

</details>

Finally, for the Tabular tables that need them, add the `buttons` and `buttonContainer` options. The `buttons` option is part of DataTables and is documented here: https://datatables.net/extensions/buttons/ The `buttonContainer` option is part of `aldeed:tabular` and does the tricky task of appending the buttons to some element in the generated table. Set it to the CSS selector for the container.

Bootstrap example:
Expand Down
Loading