簡體   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