ka215 / jquery.timeline

You can easily create the horizontal timeline with two types by using this jQuery plugin.
MIT License
240 stars 43 forks source link

Cannot add library, .done is not a function #69

Closed thomasr96 closed 3 years ago

thomasr96 commented 3 years ago

I am trying to add jquery.timeline to my Yii2 PHP project and am unable to add the minified js file to my site. When I add the minified js file, the console throws the following error:

Uncaught TypeError: promise.done is not a function
    at Object.success (humhub.client.js?v=1602137402:253)
    at fire (jquery.js?v=1603258062:3496)
    at Object.fireWith [as resolveWith] (jquery.js?v=1603258062:3626)
    at done (jquery.js?v=1603258062:9786)
    at XMLHttpRequest.<anonymous> (jquery.js?v=1603258062:10047)

My HTML is as follows:

<div id="myTimeline">
  <ul class="timeline-events">
    <li data-timeline-node="{ start:'2019-02-26 10:00',end:'2019-02-26 13:00',content:'<p>Event Body...</p>' }">Event Label</li>
    <li data-timeline-node="{ start:'2019-03-01 23:10',end:'2019-03-02 1:30' }">
      <span class="event-label">Event Label</span>
      <span class="event-content"><p>Event Body...</p></span>
    </li>
  </ul>
</div>

with js as

$("#myTimeline").Timeline({
  type: "bar",
  startDatetime: "2019-03-04 00:00",
  scale: "month",
  rows: 6,
})

I've tried it out with different 2.x.x versions as well as alpha/beta and still get the same error. I also receive the following warning: Can not parse to object therefor invalid param. right before the error. I took a look at this issue, but changing the Babel.config.js and then reminifying did not help. I also tried using the source as they did in the linked issue but that didn't work as I still got the Can not parse to object therefor invalid param. warning. I don't have much more detail that I can think of that is relevant to this weird issue, but is there any quick fix or extra troubleshooting that I could do?

Thanks

ka215 commented 3 years ago

Hi there,

Looking at the error stack, it seems that there is a problem with the exchange of Promise objects between humhub.client.js and jquery.js. I don't have detailed information about the framework called "humhub.js", so I can't point out the cause of the problem.

Please try binding jQuery.Timeline once without using "humbul.js". Also check the version of jQuery you are using.

Thank you,

thomasr96 commented 3 years ago

Thank you for the quick response. The humhub files are core files so I cannot remove them. I have been unable to find the reason why the error occurs and have now moved on to a different plugin - this issue could be closed.