Giter Club home page Giter Club logo

Comments (5)

edlynvillegas avatar edlynvillegas commented on May 23, 2024 1

Hello @joristackaert, I get your problem now, I assigned an ID with numbers only but in string type, and I encountered your error. Check my latest commit :)

EvoCalendar.prototype.selectEvent = function(event) {
var _ = this;
var el = $(event.target).closest('.event-container');
var id = $(el).data('eventIndex').toString();
var index = _.options.calendarEvents.map(function (event) { return (event.id).toString() }).indexOf(id);
var modified_event = _.options.calendarEvents[index];
if (modified_event.date instanceof Array) {
modified_event.dates_range = _.getBetweenDates(modified_event.date);
}
$(_.$elements.calendarEl).trigger("selectEvent", [_.options.calendarEvents[index]])
}

The problem is, when the event's ID is like this { id: "1234" }, in the DOM when it's assigned it looks like this data-event-index="2313213". So when you get the event id in the element ($(el).data('eventIndex')), it became a number instead of string so the index would be -1

from evo-calendar.

edlynvillegas avatar edlynvillegas commented on May 23, 2024

Hello, I tried changing the event IDs into numbers (not strings), and it's working fine. 🤔

image

image

Or am I missing something? 😅

from evo-calendar.

joristackaert avatar joristackaert commented on May 23, 2024

image

well now i'm forcing it to have an id that otherwise would come from the Database. unless something weird happens when encoding my viewmodel to JS object.
Hmm I don't really have a clue :/. maybe it's only on my end.

from evo-calendar.

joristackaert avatar joristackaert commented on May 23, 2024

Oww so that is the problem, I've been writing so much c# and typescript i forgot javascript sees that object as a number instead of a string.

thx 😉

if i have time on my hands i'll add some changes i've made to the evocalendar as pull requests.

from evo-calendar.

edlynvillegas avatar edlynvillegas commented on May 23, 2024

Sure, pull requests are welcome! Also, goodluck with your projects 🙂

from evo-calendar.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.