Comments (11)
I think PR #29 (Compile to umd with browserify) for Issue #15 may resolve this.
The new file:
dist/umd/simple-datatables.js (36k)
should show up at:
https://www.jsdelivr.com/package/npm/simple-datatables?path=dist
Then you could hit the CDN with something like:
<link rel=stylesheet href=https://cdn.jsdelivr.net/npm/[email protected]/dist/style.css>
<script src=https://cdn.jsdelivr.net/npm/[email protected]/dist/umd/simple-datatables.js></script>
Because of the UMD wrapper, you instantiate like this:
const dataTable = new simpleDatatables.DataTable(elem, config);
from simple-datatables.
@rigwild The package that is currently provided is transpiled using buble. Is that not good enough?
Do you have any preference for how the CDN version should be packaged? Would https://unpkg.com/ be an acceptable option?
from simple-datatables.
@rigwild Thanks, I updated the readme for 2.1.4. So with this I assume this issue has been fixed and I'll close it. Please reopen if this is not the case.
from simple-datatables.
I didn't see that the package was transpiled, sorry.
unpkg is great. You also have https://www.jsdelivr.com/, but both are equally good CDNs.
from simple-datatables.
@rigwild Is jsdelivr set up automatically so that https://cdn.jsdelivr.net/npm/simple-datatables works already?
from simple-datatables.
Looks like it! Adding this link to the README.md would be a nice addition.
from simple-datatables.
If this is something you are using, it would be good to find out if the dynamic import is working before listing it. Try to check if you can sort anything by date. That should dynamically load an extra file. That seems to be tricky in some setups. See #14 .
from simple-datatables.
I spoke too soon. It does not work.
simple-datatables:5 Uncaught ReferenceError: exports is not defined
see: https://codepen.io/anon/pen/qGawej
There's a workaround making it work (but it's a bit hacky), but the date sorting does not work as require
is used :
<script>var exports = {}</script>
Maybe format: 'iife'
in rollup.config.js is what we are looking for ? (I don't know rollup so I can't provide a PR 😞 )
see: https://rollupjs.org/guide/en#output-format
from simple-datatables.
@rigwild See the discussion in #14 - iife does not work for rollup under the current circumstances. But maybe we an switch to webpack?
from simple-datatables.
@dpilafian I think you may be right. I have added the required extra fields in package.json
so that it should be served on both unpkg and jsdelivr at https://cdn.jsdelivr.net/npm/simple-datatables and https://unpkg.com/simple-datatables . However I haven't tested this, so please do before we close this ticket. Also, it is still serving me the 2.1.1 version unless I manually specify that I want version 2.1.3. I have tried in several browsers, and from the documentation on those websites I don't really see how to invalidate the CDN's cache. I hope it does so automatically eventually. Else we'll need to change the URLs in the readme.
from simple-datatables.
It actually works!
See: https://codepen.io/anon/pen/vwvWwg
For URLs, the trick seems to be to use the @latest
tag instead of the version number (or nothing).
Don't forget to add the CSS too.
<link href="https://cdn.jsdelivr.net/npm/simple-datatables@latest/dist/style.css" rel="stylesheet" type="text/css">
<script src="https://cdn.jsdelivr.net/npm/simple-datatables@latest" type="text/javascript"></script>
from simple-datatables.
Related Issues (20)
- [BUG] Cant get Template to work... HOT 1
- [REQUEST] Row Group
- multiSearch not working for me HOT 5
- Title/field headings HOT 5
- Support for colgroup
- [BUG] init() method has no options parameter anymore? HOT 6
- events cannot be fired in the chrome environment HOT 2
- [BUG] A form field element should have an id or name attribute - HTML validity
- [BUG] Can't sort numeric columns
- [BUG] Columns.hide() and show() don't work with integer values
- Responsive Mobile HOT 1
- [BUG]`TypeError: Cannot read properties of undefined (reading 'settings')` at re insert table in version ^9.0.0 HOT 4
- [Feature Request] Ability to hide rows HOT 6
- [BUG] searchQuerySeparator not working via CDN HOT 2
- [BUG] columns property not properly generated HOT 2
- [BUG] Destroying and removing the table element is not working correctly HOT 1
- [BUG] data-order HOT 1
- [BUG] attribute data-sort not working in <th> HOT 2
- Sorting with empty cells doesn't work correctly.[BUG]
- Input Listeners not working on subsequent pages [BUG] HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from simple-datatables.