fullcalendar的回调函数包含源码

更新时间:2023-06-22 22:07:19 阅读: 评论:0

fullcalendar的回调函数包含源码今天帮同事研究了⼀下 fullcalendar的回调函数。
需求是  使⽤fullcalendar ,但是纵向布局不按照时间刻度,以列表的形式。
思路是  在插件视图渲染的完成后执⾏回调,编写回调函数,达到⾃⼰的⽬的。
由于fullcalendar的回调函数⽐较零乱,这⾥归纳到⼀块,⼀起做个总结。
点击
1、viewRender  视图渲染(初始化)回调函数。
//视图渲染时,也就是初始化,执⾏的回调函数
//通过这个地⽅可以添加⾃⼰类似于loadSuccess 的回调函数
源码
iggerViewRender = function () {
this.publiclyTrigger('viewRender', {
context: this,
args: [this, this.el]
});
};
//我这这个回调⾥去掉了时间刻度尺
viewRender:function(){
//alert("render");
$(".fc-axis").hide();
}
2、viewDestroy  视图销毁回调函数。
// 视图销毁时执⾏的回调函数
源码:
iggerViewDestroy = function () {
this.publiclyTrigger('viewDestroy', {
context: this,
args: [this, this.el]
});
};
3、dayClick  在视图上点击⼀个(以天为单位)单元格区域 触发的回调。
//区域范围只有在start部分才是可⽤的。
iggerDayClick = function (footprint, dayEl, ev) {
宝宝一周岁var dateProfile = this.calendar.footprintToDateProfile(footprint); // abu of "Event"DateProfile?
this.publiclyTrigger('dayClick', {
context: dayEl,
args: [dateProfile.start, ev, this]
});
};
4、eventRender  事件渲染 (就是根据数据渲染⽇程) 当⽇程事件渲染时触发(⼀条数据执⾏⼀次)。
// 给⼀个默认的dom元素,通过回调返回⼀个真实的dom元素。
EventRenderer.prototype.filterEventRenderEl = function (eventFootprint, el) {
var legacy = EventLegacy();
var custom = this.view.publiclyTrigger('eventRender', {
context: legacy,
args: [legacy, el, this.view]
});
if (custom === fal) {
el = null;
}
el if (custom && custom !== true) {
el = $(custom);
}
我的网课作文return el;
};
5、eventAfterRender  渲染后触发的回调事件(⼀条数据执⾏⼀次)
iggerAfterEventSegsRendered = function (gs) {
var _this = this;
// an optimization, becau getEventLegacy is expensive
if (this.hasPublicHandlers('eventAfterRender')) {
gs.forEach(function (g) {
var legacy;
if (g.el) {
legacy = EventLegacy();
_this.publiclyTrigger('eventAfterRender', {
context: legacy,
args: [legacy, g.el, _this]
});
}
});
}
};
6、eventAfterAllRender  当所有⽇程事件 渲染全部渲染完成后 触发。我的实际应⽤是在这之后从新调整布局。
iggerAfterEventsRendered = function () {
this.publiclyTrigger('eventAfterAllRender', {
context: this,
args: [this]
});
};
7、loading  数据加载前后的回调⽅法,这个⽅法会在有数据加载调⽤时,执⾏两次。根据参数判断执⾏前,还是执⾏后。第⼀个参数为true,执⾏前的回调; 第⼀个参数为fal ,执⾏后的回调。
Calendar.prototype.pushLoading = function () {
if (!(this.loadingLevel++)) {
this.publiclyTrigger('loading', [true, this.view]);
}
};
// Should be called when any type of async data fetching completes
打土豪Calendar.prototype.popLoading = function () {
if (!(--this.loadingLevel)) {
this.publiclyTrigger('loading', [fal, this.view]);
}
};
8、windowResize  当窗⼝⼤⼩调整时候,触发的回调⽅法。
Calendar.prototype.windowResize = function (ev) {
if (
// the purpo: so we don't process jqui "resize" events that have bubbled up
// cast to any becau .target, which is Element, can't be compared to window for some reason.        ev.target === window &&
this.view &&
this.view.isDatesRendered) {
if (this.updateViewSize(true)) {
this.publiclyTrigger('windowResize', [this.view]);
}
黄慢}
};
9、eventResizeStart  ⽇程从新调整开始时候触发的回调⽅法。
EventResizing.prototype.gResizeStart = function (g, ev) {
第四英语this.isResizing = true;
context: g.el[0],
args: [
EventLegacy(),
ev,
{},
this.view
]
});
};
10、eventResizeStop ⽇程从新调整结束时候触发的回调⽅法。
EventResizing.prototype.gResizeStop = function (g, ev) {
this.isResizing = fal;
context: g.el[0],
福谋
args: [
EventLegacy(),
ev,
{},
this.view
]
});
};
11、eventDragStart  ⽇程从拖动开始时候触发的回调⽅法。
EventDragging.prototype.gDragStart = function (g, ev) {
this.isDragging = true;
翡翠黄加绿
context: g.el[0],
args: [
EventLegacy(),
ev,
{},
this.view
]
});
};
12、eventDragStop  ⽇程从拖动结束时候触发的回调⽅法。
EventDragging.prototype.gDragStop = function (g, ev) {
this.isDragging = fal;
context: g.el[0],
args: [
EventLegacy(),
ev,
{},
this.view
]
});
};
13、eventDrop ⽇程拖动到放⼊时触发的事件。
iggerEventDrop = function (eventInstance, dateDelta, undoFunc, el, ev) {
this.publiclyTrigger('eventDrop', {
context: el[0],
args: [
dateDelta,
undoFunc,
ev,
{},
this
]
});
};
14、lect  ⽇程被选中时触发的回调
iggerSelect = function (footprint, ev) {
var dateProfile = this.calendar.footprintToDateProfile(footprint); // abu of "Event"DateProfile?        this.publiclyTrigger('lect', {
context: this,
args: [
dateProfile.start,
ev,
this
]
});
};
15、unlect  ⽇程被选中时触发的回调。
View.prototype.unlect = function (ev) {
if (this.isSelected) {
this.isSelected = fal;
if (this['destroySelection']) {
this['destroySelection'](); // TODO: deprecate            }
this.unrenderSelection();
this.publiclyTrigger('unlect', {
context: this,
args: [ev, this]
});
职业黑粉}
};
先写这么多吧。

本文发布于:2023-06-22 22:07:19,感谢您对本站的认可!

本文链接:https://www.wtabcd.cn/fanwen/fan/89/1050420.html

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。

标签:回调   触发   渲染   时候   函数   时间   视图
相关文章
留言与评论(共有 0 条评论)
   
验证码:
推荐文章
排行榜
Copyright ©2019-2022 Comsenz Inc.Powered by © 专利检索| 网站地图