-
Notifications
You must be signed in to change notification settings - Fork 63
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
API to access calendar columns #40
Comments
A few commits ago (d7fa9f7) I added support for some undocumented handlers. One of them was
{
"isCurrent" : true|false, // If the set date on calendar
"isSelected" : true|false, // If date is selected or not
"isPreviousMonth" : true|false, // If date is on previous month
"isCurrentMonth" : true|false, // If date is on current month
"isNextMonth" : true|false, // If date is on next month
"position" : {
"x" : 0-6, // Date x-position on calendar grid
"y" : 0-5 // Date y-position on calendar grid
}
} In the same way, maybe we can implement a method (I am not sure about the name, and maybe with optional filter argument) which will return an array of objects like the Maybe we should stick with a Any thoughts on all that? Would that cover your needs? On what cases are you planning on using it? Are we missing anything? PS: Thanks for loving and using jsCalendar. |
Oh, cool, I didn't know that these exist, I'm using the latest stable release (v1.4.3). I'm using this to create JavaScript-based tooltips for some selected dates (i.e. simple event tooltips). Currently I'm achieving this by utilizing Some thoughts on A event-based solution is even better than getters. I can't think of use cases which can't be implemented using a event-based solution and actually require getters. Tagging a new release would be great (possibly after switching to a event-based approach if you like)! 👍 |
It looks like I have to change the I like the custom events approach too, maybe in an other parallel universe, where IE is not a thing, there is a jsCalendar with custom events. So, for now I think we will play safe with my fake events (which now, in the beta, supports PS: A version should have been released, but other things got in the way. |
|
I don't know 🤔 ... Based on Mozilla's dec docs I think that IE9 supports the deprecated API. I do like the CustomEvents idea and I think the best approach would be to implement the CustomEvents on a later release and provide a 2nd script (like a library extension) that would fix any incompatibility with older browsers. But for now I should rush the 1.4.4 release, so I think we need to play safe. |
Related commit 9b33654 |
API was included in v1.4.4 |
Great work, thanks @GramThanos ❤️ |
Sorry for the spam :P, I comment changes just to know what is going on later in case I forget them. |
Currently there's no public API to access a calendar's columns (i.e. the
<td>
elements resp.HTMLElement
objects). The only way to access those is currently using the (actually hidden)_active
array and iterating all columns:There should be distinct APIs to return the above
columns
,previousColumns
,nextColumns
,selectedColumns
andcurrentColumn
variables. The API should either return an object with allHTMLElement
objects indexed by timestamp (as shown above) or rather an array containing objects withDate
andHTMLElement
objects (e.g.[ { date: /* [Date] object */, element: /* [HTMLElement] object */ } ]
), depending on your preference.Great project, I love slim but still powerful libraries like yours! 👍
The text was updated successfully, but these errors were encountered: