$(...)。gantt不是一个函数

时间:2016-05-19 12:28:22

标签: javascript jquery symfony gantt-chart

我想在我的网站上显示一些甘特图,但他们不会出现。相反,我得到一个TypeError。

网站(未完整显示):

<body>
   {% block body %}
       <div class="container">
          <div class="gantt" id="gantt"></div>
          //... some stuff (only <div></div> and some <span></span> tags)
          <div class="gantt" id="gantt2"></div>
          //... even more stuff
          <div class="gantt" id="gantt3"></div>
       </div>
   {% endblock %}

   //Here I include the jquery.fn.gantt.js, etc.
   {% block javascripts %}
        {% javascripts '@jquery_js' '@bootstrap_js' '@jquery_gantt' combine=true       %}
        <script src="{{ asset_url }}"></script>
        <script>
            $("#gantt").gantt({
                source: [{
                    name: "Example",
                    desc: "Lorem ipsum dolor sit amet.",
                    values: [{
                            from: "/Date(1333411200000)/",
                            to: "/Date(1328832000000)/",
                            label: "Example Value",
                            desc: "Something",
                            customClass: "ganttRed"}]
                    }],
               scale: "weeks",
               minScale: "hours",
               navigate: "scroll"
           });
           $("#gantt1").gantt({
               source: [{... same as above ...}],
               scale: "weeks",
               minScale: "hours",
               navigate: "scroll"
           });
           $("#gantt2").gantt({
               source: [{... same as above ...}],
               scale: "weeks",
               minScale: "hours",
               navigate: "scroll"
           });
        </script>
        {% endjavascripts %}
    {% endblock %}
</body>

和config.yml:

jquery_js:
    inputs:
        - '%kernel.root_dir%/../vendor/components/jquery/jquery.js'
        - '%kernel.root_dir%/../vendor/components/jquery/jquery.min.js'
bootstrap_js:
    inputs:
        - '%kernel.root_dir%/../vendor/components/bootstrap/js/bootstrap.min.js'
jquery_gantt:
    inputs:
        - '%kernel.root_dir%/../src/AppBundle/js/jquery.fn.gantt.js'
        - '%kernel.root_dir%/../src/AppBundle/js/jquery.fn.gantt.min.js'

如果我现在运行此代码,除了出现此错误外没有任何反应:

TypeError: $(...).gantt is not a function

我不知道发生了什么或如何解决这个问题,因为一切对我来说都是正确的。包含.js / .css文件并正确加载。

0 个答案:

没有答案