Skip to content
This repository was archived by the owner on Nov 27, 2018. It is now read-only.

Commit ecb9397

Browse files
authored
Make it crystal clear that you need to define optionsObject before using it
1 parent 1bf4fc4 commit ecb9397

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

README.md

+11-9
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,6 @@ In your template:
2020
dataTableData = function () {
2121
return Meteor.users.find().fetch(); // or .map()
2222
};
23-
24-
Template.containsTheDataTable.helpers({
25-
reactiveDataFunction: function () {
26-
return dataTableData;
27-
},
28-
optionsObject: optionsObject // see below
29-
});
30-
3123

3224
Set up your datatable's options as per the jquery.dataTables API, e.g.:
3325

@@ -52,8 +44,18 @@ Set up your datatable's options as per the jquery.dataTables API, e.g.:
5244
return img;
5345
}
5446

47+
Then just provide the options and data to the DataTable view Meteor's helpers:
48+
49+
Template.containsTheDataTable.helpers({
50+
reactiveDataFunction: function () {
51+
return dataTableData;
52+
},
53+
54+
// NOTE: The following line has to appear AFTER you define options (as we did above):
55+
optionsObject: optionsObject
56+
});
5557

56-
I've deliberately kept this package as close as possible to the original API. I've also deliberately not exposed any global variables, although you can access the DataTable API in the usual jquery way using the '#datatable' selector from your template, i.e., to get an array with your data:
58+
I've deliberately kept this package as close as possible to the original API, and avoided adding any package-specific API wherever possible - use the DataTables manual if you need to do any fancy manipulations! I've also deliberately not exposed any global variables, although you can access the DataTable API in the usual jquery way using the '#datatable' selector from your template, i.e., to get an array with your data:
5759

5860
`$('#datatable').DataTable().rows()`
5961

0 commit comments

Comments
 (0)