-
Notifications
You must be signed in to change notification settings - Fork 6.1k
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
Allow customizing day cell value #2043
Changes from 1 commit
e1dfbbd
c5cafb5
c544da6
601c6a6
77af1d0
a5db368
8751c13
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1017,6 +1017,8 @@ | |
clsName = this.getClassNames(prevMonth); | ||
clsName.push('day'); | ||
|
||
var displayDate = prevMonth.getUTCDate(); | ||
|
||
if (this.o.beforeShowDay !== $.noop){ | ||
before = this.o.beforeShowDay(this._utc_to_local(prevMonth)); | ||
if (before === undefined) | ||
|
@@ -1031,6 +1033,8 @@ | |
clsName = clsName.concat(before.classes.split(/\s+/)); | ||
if (before.tooltip) | ||
tooltip = before.tooltip; | ||
if (before.displayDate) | ||
displayDate = before.displayDate; | ||
} | ||
|
||
//Check if uniqueSort exists (supported by jquery >=1.12 and >=2.2) | ||
|
@@ -1041,7 +1045,7 @@ | |
clsName = $.unique(clsName); | ||
} | ||
|
||
html.push('<td class="'+clsName.join(' ')+'"' + (tooltip ? ' title="'+tooltip+'"' : '') + (this.o.dateCells ? ' data-date="'+(prevMonth.getTime().toString())+'"' : '') + '>'+prevMonth.getUTCDate() + '</td>'); | ||
html.push('<td class="'+clsName.join(' ')+'"' + (tooltip ? ' title="'+tooltip+'"' : '') + (this.o.dateCells ? ' data-date="'+(prevMonth.getTime().toString())+'"' : '') + '>' + displayDate + '</td>'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You are actually making the other views sad and envious to the monthView :) |
||
tooltip = null; | ||
if (weekDay === this.o.weekEnd){ | ||
html.push('</tr>'); | ||
|
@@ -1196,6 +1200,10 @@ | |
} | ||
|
||
if (!target.hasClass('disabled')){ | ||
// Allow clicking on elements inside a day | ||
if (target.parent().hasClass('day')) | ||
target = target.parent(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since you allow html, you code won't work if I send There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure that e.currentTarget would work because bubbling/propagation are stopped at the top of the click handler. Instead, I use .parents(), does that work? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It should I guess |
||
|
||
// Clicked on a day | ||
if (target.hasClass('day')){ | ||
day = Number(target.text()); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since other tickets like #2037 would like such PR, I think a more abstract name for this option should be use, like
content
. Do you guys agree @acrobat @vsn4ik @hebbet ?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍