Skip to content

Commit

Permalink
update doc, peer deps
Browse files Browse the repository at this point in the history
  • Loading branch information
noogen committed Nov 5, 2018
1 parent faab2ae commit d441bb4
Show file tree
Hide file tree
Showing 10 changed files with 124 additions and 57 deletions.
82 changes: 45 additions & 37 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,44 +107,52 @@ Since it's a wrapper, all/most features are provided by the [jQuery DataTables](
## Parameters
Our component parameters:
```javascript
props: {
// Set the table classes you wish to use, default with bootstrap4
// but you can override with: themeforest, foundation, etc..
className: {
type: String,
default: 'table table-striped table-bordered dt-responsive nowrap w-100'
},
// the options object: https://datatables.net/manual/options
opts: {
type: Object
},
/**
* List all fields to be converted to opts columns
*
* @type {Object}
*/
fields: {
type: Object
},
/**
* Pass in DataTables.Net loaded jQuery to resolve
* any multiple loaded browser jQuery conflict
*
* @type {Object}
*/
jquery: {
type: Object
},
/**
* True to enable multi-select checkboxes
* Current implementation require datatables.net-select
*
* @type Boolean
*/
selectable: {
type: Boolean
props: {
/**
* Set the table classes you wish to use, default with bootstrap4
* but you can override with: themeforest, foundation, etc..
*
* @type String
*/
className: {
type: String,
default: 'table table-striped table-bordered nowrap w-100'
},
/**
* the options object: https://datatables.net/manual/options
*
* @type Object
*/
opts: {
type: Object
},
/**
* List all fields to be converted to opts columns
*
* @type Object
*/
fields: {
type: Object
},
/**
* Pass in DataTables.Net loaded jQuery to resolve
* any multiple loaded browser jQuery conflict
*
* @type Object
*/
jquery: {
type: Object
},
/**
* True to enable multi-select checkboxes
* Current implementation require datatables.net-select
*
* @type Boolean
*/
selectable: {
type: Boolean
}
}
},
```

`fields` is an schema object that identify all datatables.net columns, example:
Expand Down
44 changes: 37 additions & 7 deletions dist/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions example/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ export default {
lengthChange: true,
serverSide: true,
fixedHeader: true,
saveState: true,
buttons: ['copy', 'csv', 'print']
},
fields: {
Expand Down
2 changes: 1 addition & 1 deletion lib/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion lib/index.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions lib/mix-manifest.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"/index.js": "/index.js?id=542b91159c8523321093",
"/index.js.map": "/index.js.map?id=3bc06a22bacc66deaa63"
"/index.js": "/index.js?id=5ee5f53ccf2d5efe4573",
"/index.js.map": "/index.js.map?id=4dc5128abdf6f7ba4dea"
}
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "vue-datatables-net",
"description": "Vue jQuery DataTables.net wrapper component",
"version": "0.9.0",
"version": "0.9.1",
"author": "friends@niiknow.org",
"license": "MIT",
"main": "lib/index.js",
Expand Down Expand Up @@ -30,7 +30,7 @@
"not ie <= 8"
],
"peerDependencies": {
"datatables.net": "^1.10.19",
"jquery": ">=1.7",
"vue": ">=2.0.0"
},
"devDependencies": {
Expand Down
38 changes: 33 additions & 5 deletions src/VdtnetTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -31,20 +31,28 @@
export default {
name: 'VdtnetTable',
props: {
// Set the table classes you wish to use, default with bootstrap4
// but you can override with: themeforest, foundation, etc..
/**
* Set the table classes you wish to use, default with bootstrap4
* but you can override with: themeforest, foundation, etc..
*
* @type String
*/
className: {
type: String,
default: 'table table-striped table-bordered nowrap w-100'
},
// the options object: https://datatables.net/manual/options
/**
* the options object: https://datatables.net/manual/options
*
* @type Object
*/
opts: {
type: Object
},
/**
* List all fields to be converted to opts columns
*
* @type {Object}
* @type Object
*/
fields: {
type: Object
Expand All @@ -53,7 +61,7 @@ export default {
* Pass in DataTables.Net loaded jQuery to resolve
* any multiple loaded browser jQuery conflict
*
* @type {Object}
* @type Object
*/
jquery: {
type: Object
Expand Down Expand Up @@ -239,6 +247,13 @@ export default {
}
})
},
beforeDestroy() {
const vm = this
if (vm.dataTable) {
vm.dataTable.destroy(true)
}
vm.dataTable = null
},
methods: {
compileTemplate(template) {
const vm = this
Expand All @@ -259,6 +274,19 @@ export default {
}
return renderFunc
},
/**
* Set table data array that was loaded from somewhere else
* This method allow for local setting of data; though, it
* is recommended to use ajax instead of this.
*
* @param Array data the array of data
*/
setTableData(data) {
const vm = this
vm.dataTable.clear().rows.add(data)
vm.dataTable.draw(false)
vm.dataTable.columns.adjust()
}
}
}
Expand Down

0 comments on commit d441bb4

Please sign in to comment.