gpt4 book ai didi

javascript - 浏览数据表

转载 作者:数据小太阳 更新时间:2023-10-29 04:38:23 25 4
gpt4 key购买 nike

我尝试按照 NPM packages - DataTables 中的说明进行操作但我仍然无法将它与 Browserify 捆绑在一起。

这是我的最小、完整且可验证的示例:

应用程序.js

'use strict'

var $ = require('jquery')
var dt = require('datatables.net-dt')()

$(document.getElementById('table')).DataTable()

npm list 的输出

foo@1.0.0 /home/RinkAttendant6/www/foo
├─┬ datatables.net@1.10.10
│ └── jquery@2.1.4
└── datatables.net-dt@1.5.2

browserify app.js -o bundle.js 的输出

Error: Cannot find module 'datatables.net-dt' from '/home/RinkAttendant6/www/foo'
at /usr/lib/node_modules/browserify/node_modules/resolve/lib/async.js:46:17
at process (/usr/lib/node_modules/browserify/node_modules/resolve/lib/async.js:173:43)
at ondir (/usr/lib/node_modules/browserify/node_modules/resolve/lib/async.js:188:17)
at load (/usr/lib/node_modules/browserify/node_modules/resolve/lib/async.js:69:43)
at onex (/usr/lib/node_modules/browserify/node_modules/resolve/lib/async.js:92:31)
at /usr/lib/node_modules/browserify/node_modules/resolve/lib/async.js:22:47
at FSReqWrap.oncomplete (fs.js:82:15)

我做错了什么?

最佳答案

根据包 vendor 的说法,除非使用 Bootstrap 或 Foundation,否则应使用 datatables.net 包而不是 datatables.net-dt

引用https://github.com/DataTables/DataTables/issues/434#issuecomment-161278064

Instead use:

var dt = require('datatables.net')()

The reason for this is that the datatables.net-dt package does not contain a Javascript file - it doesn't need one - it contains only CSS (it should actually contain a couple of images as well, that will be corrected in 1.10.11).

No Javascript file is required there since the DataTables defaults are suitable for DataTables styling. The same is not the case for Bootstrap, etc.

关于javascript - 浏览数据表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33949780/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com