繁体   English   中英

使用带有requirejs的stickytableheaders无法加载

[英]using stickytableheaders with requirejs not loading

我正在尝试用requirejs加载stickytableheaders ,但似乎无法使其正常工作。 总是说找不到。 我已经确认它是在使用脚本之前先加载该脚本的。

任何想法为什么$("table").stickyTableHeaders(); 会抛出undefined is not a function错误吗?

配置文件

var require = {
    baseUrl: "/",
    paths: {
        "bootstrap": "Scripts/bootstrap/bootstrap",
        "jquery": "Scripts/jquery/jquery-1.9.1",        
        "stickyTableHeaders": "Scripts/stickyheader/stickyheader",
        "knockout": "Scripts/knockout/knockout-3.3.0",
        "text": "Scripts/require/text",
        "domReady": "Scripts/require/domReady"
    },
    shim: {
        "bootstrap": {
            deps: ["jquery"]
        },
        'stickyTableHeaders': {
            deps: ['jquery'],
            exports: 'jQuery.fn.stickyTableHeaders'
        }
    }
}

启动文件

require(['jquery'
    , 'knockout'
    , 'Scripts/App/components/appViewModel'
    , 'stickyTableHeaders'
    , 'bootstrap'
    , '/Scripts/knockout/bindinghandlers.js'
    , 'domReady!']
    , function ($, ko, appViewModel, stickyTableHeaders) {

    ko.components.register('reportingline', { require: 'Scripts/App/components/reportingline/line' });
    ko.components.register('newrpt', { require: 'Scripts/App/components/newrpt/newreport' });

    $("table").stickyTableHeaders();

    ko.applyBindings(new appViewModel());
})

我能够使它正常工作。

我必须将代码添加到所需页面的视图模型的末尾。 似乎应该有一种全球性的方法。

$(“ table”)。stickyTableHeaders();

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM