- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
所以我在 github 页面上发布了一个关于 angular fullcalendar 的问题,但我想我会在这里尝试一下,看看是否有人能发现我的代码的问题,或者我是否发现了一个错误。
所以我在时间线 View 中加载资源时遇到了问题。下面是我所做的一个简单的娱乐:
组件.ts:
import { Component, OnInit, ViewChild, Input, AfterViewInit, OnDestroy } from '@angular/core';
import { FullCalendarComponent } from '@fullcalendar/angular';
import { CalendarFunctionsService } from '@_shared/calendar-functions.service';
import resourceCommon from '@fullcalendar/resource-common';
import resourceTimelinePlugin from '@fullcalendar/resource-timeline';
import moment from 'moment';
import { take } from 'rxjs/operators';
@Component({
selector: 'app-acalendar',
templateUrl: './acalendar.component.html',
styleUrls: ['./acalendar.component.sass']
})
export class AcalendarComponent implements OnInit, AfterViewInit, OnDestroy {
@Input() calendarOutlet: string;
@ViewChild('calendar', {static: true}) calendarComponent: FullCalendarComponent;
initialLoad: boolean = true;
options: any;
events = (fetchInfo, successCallback, failureCallback) => {
// debugger;
this.week = this.fns.weekResolver(fetchInfo);
this.day = fetchInfo.start.getDay();
// console.log(this.week + " " + this.day);
this.adminApi.getSlots(this.week, this.day).pipe(take(1)).subscribe (
res => { if (res && this.initialLoad === true) {
this.alertService.success('Availability slots successfully loaded!', true);
successCallback(res);
} else { successCallback(res); console.log("loaded events") }
},
error => { console.log("response: " + error); this.alertService.error("There was a problem loading availabilities: " + error );
})
}
resources = (fetchInfo, successCallback, failureCallback) => {
// debugger;
// the following line is commented because fetchInfo is undefined:
// this.adminApi.getSlots(this.fns.weekResolver(fetchInfo), fetchInfo.start.getDay())
// using scalar values because fetchInfo is undefined
this.adminApi.getSlots(47, 3)
.pipe(take(1))
.subscribe (
res => {
let resourceArray = [];
if (res && this.initialLoad == true){
this.alertService.success('Availability slots loaded', true);
this.initialLoad = false;
for (let item of res){
resourceArray.push({id: item.resourceId, title: item.caregiver, caregiver: item.caregiver, day: this.fns.dayNameResolver(item.day)})
}
successCallback(resourceArray);
}
},
error => {console.log("response: "+error); this.alertService.error("There was a problem loading availabilities: "+error);}
)
}
constructor (
private alertService: AlertService,
private adminApi: AdminApiService,
private fns: CalendarFunctionsService
) { }
ngOnInit() {
this.options = {
plugins: [resourceCommon, resourceTimelinePlugin],
header: {
left: '',
center: 'title',
right: 'day, prev, next'
},
views: {
resourceTimelineDay: {
type: 'resourceTimelineDay',
minTime: '06:00:00',
maxTime: '24:00:00',
slotDuration: '00:30:00',
resourceOrder: 'caregiver',
resourceLabelText: 'Caregiver',
resourceAreaWidth: '15%',
refetchResourcesOnNavigate: true,
}
},
}
}
ngAfterViewInit(): void {
//Called after ngAfterContentInit when the component's view has been initialized. Applies to components only.
//Add 'implements AfterViewInit' to the class.
console.log("Api: ");
console.log(this.calendarComponent.getApi());
this.calendarComponent.getApi().refetchResources;
}
<full-calendar #calendar
schedulerLicenseKey = "GPL-My-Project-Is-Open-Source"
[plugins] = "this.options.plugins"
defaultView = "resourceTimelineDay"
[header] = "this.options.header"
[views] = "this.options.views"
contentHeight = "auto"
[events] = "events"
[resources] = "resources"
>
</full-calendar>
import { NgModule, ModuleWithProviders } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FullCalendarModule } from '@fullcalendar/angular';
import { EcalendarComponent } from '@layouts/components/ecalendar/ecalendar.component';
import { AcalendarComponent } from '@layouts/components/acalendar/acalendar.component';
@NgModule({
imports: [
CommonModule,
FullCalendarModule
],
declarations: [
EcalendarComponent,
AcalendarComponent
],
exports: [
EcalendarComponent,
AcalendarComponent
],
providers: [],
bootstrap: []
})
export class CalendarModule {
// static forRoot(): ModuleWithProviders {
// return {
// ngModule: CalendarModule,
// providers: [ ]
// };
// }
}
range
在以下代码中,
if (arg.range)
失败部分。
registerResourceSourceDef({
parseMeta: function (raw) {
if (typeof raw === 'function') {
return raw;
}
else if (typeof raw.resources === 'function') {
return raw.resources;
}
return null;
},
fetch: function (arg, success, failure) {
var dateEnv = arg.calendar.dateEnv;
var func = arg.resourceSource.meta;
var publicArg = {};
if (arg.range) {
publicArg = {
start: dateEnv.toDate(arg.range.start),
end: dateEnv.toDate(arg.range.end),
startStr: dateEnv.formatIso(arg.range.start),
endStr: dateEnv.formatIso(arg.range.end),
timeZone: dateEnv.timeZone
};
}
// TODO: make more dry with EventSourceFunc
// TODO: accept a response?
unpromisify(func.bind(null, publicArg), function (rawResources) {
success({ rawResources: rawResources }); // needs an object response
}, failure // send errorObj directly to failure callback
);
}
});
"dependencies": {
"@angular/animations": "^8.2.4",
"@angular/cdk": "^8.1.4",
"@angular/common": "~8.2.3",
"@angular/compiler": "~8.2.3",
"@angular/core": "~8.2.3",
"@angular/forms": "~8.2.3",
"@angular/material": "^8.1.4",
"@angular/platform-browser": "~8.2.3",
"@angular/platform-browser-dynamic": "~8.2.3",
"@angular/router": "~8.2.3",
"@auth0/angular-jwt": "^3.0.0",
"@fortawesome/angular-fontawesome": "^0.3.0",
"@fortawesome/fontawesome-svg-core": "^1.2.22",
"@fortawesome/free-solid-svg-icons": "^5.10.2",
"@fullcalendar/angular": "^4.3.1",
"@fullcalendar/bootstrap": "^4.3.0",
"@fullcalendar/core": "^4.3.1",
"@fullcalendar/daygrid": "^4.3.0",
"@fullcalendar/interaction": "^4.3.0",
"@fullcalendar/luxon": "^4.3.0",
"@fullcalendar/moment": "^4.3.0",
"@fullcalendar/resource-common": "^4.3.1",
"@fullcalendar/resource-daygrid": "^4.3.0",
"@fullcalendar/resource-timegrid": "^4.3.0",
"@fullcalendar/resource-timeline": "^4.3.0",
"@fullcalendar/timegrid": "^4.3.0",
"@fullcalendar/timeline": "^4.3.0",
"@ng-bootstrap/ng-bootstrap": "^5.1.0",
"@types/jquery": "^3.3.31",
"bootstrap-css-only": "^4.3.1",
"bulma": "^0.7.5",
"chart.js": "^2.8.0",
"express": "^4.17.1",
"font-awesome": "^4.7.0",
"hammerjs": "^2.0.8",
"jquery": "^3.4.1",
"ngx-uploader": "^7.1.0",
"particles.js": "^2.0.0",
"perfect-scrollbar": "^1.4.0",
"rxjs": "~6.4.0",
"shortid": "^2.2.15",
"tslib": "^1.10.0",
"zone.js": "~0.9.1"
},
"devDependencies": {
"@angular-devkit/build-angular": "~0.803.1",
"@angular/cli": "~8.3.1",
"@angular/compiler-cli": "~8.2.3",
"@angular/language-service": "~8.2.3",
"@types/jasmine": "~3.3.8",
"@types/jasminewd2": "~2.0.3",
"@types/node": "^8.9.5",
"codelyzer": "^5.0.0",
"jasmine-core": "~3.4.0",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~4.1.0",
"karma-chrome-launcher": "~2.2.0",
"karma-coverage-istanbul-reporter": "~2.0.1",
"karma-jasmine": "~2.0.1",
"karma-jasmine-html-reporter": "^1.4.0",
"protractor": "~5.4.0",
"ts-node": "~7.0.0",
"tslint": "~5.15.0",
"typescript": "~3.5.3"
}
最佳答案
我想到了。显然我放错地方了refetchResourcesOnNavigate: true,
它应该作为括号选项位于 component.html.ts 文件中。
希望这对其他人有帮助。
关于angular - Fullcalendar v4 - 资源(作为函数): fetchInfo is null,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59002569/
有没有办法在 FullCalendar 中动态更改事件模板? 更新。 我想要的是指定新的事件 html(例如在 eventRender 回调中)并使 FullCalendar 将其用于我的事件渲染。像
我正在使用 FullCalendar 组件,我需要为周末、周五和周六着色。 我已经按照这里的建议使用了以下内容: Can I set a different color for the weekend
我正在实现 fullcalendar 并在时区问题上苦苦挣扎。 这是代码: $('#calendar').fullCalendar({ //re-initialize the calendar
我希望 fullCalendar 在不重新加载页面的情况下重绘自身(所有结构和事件)。 场景: 我正在使用支持 Resource View 的 fullCalendar 补丁。 .对于一些用户操作,我
我想在同一页面上添加多个 FullCalendars(可选)以安排不同类型的事件并将信息保存在数据库中,但查看演示/示例代码,我似乎每页只能添加一个日历,因为它由 呈现。 .您能否让我知道是否有办法
我已将 FullCalendar 设置为接受 drop,确实如此。但是我用 revert:'invalid' 构造的可拖动对象似乎无法将 FullCalendar 上的日期识别为可放置的,并恢复回来。
我公司最近购买了 Full-Calendar Scheduler 插件。有没有正确的方法在代码中隐藏许可证 key ?对此有哪些好的做法? 最佳答案 你是对的,没有办法完全隐藏 schedulerLi
在 FullCalendar如何使资源可点击? 我已经检查了 API,但我看不到任何相关内容,我是否遗漏了什么? 我在找 resource-click -事件就像我们对事件一样? 最佳答案 在 res
我有额外的数据(在我的例子中是一个数字),它是通过一个 javascript 函数获得的——我想在每天的单元格中显示它。 例如 - 如果天数在右上角,我希望它显示在左上角 - 每天自动显示。 我看到有
我在单个页面上创建多个 fullcalendar,我想编写一个事件渲染回调,以便它可以从调用它的 fullcalendar 实例中读取选项,例如 minTime 和 maxTime,不知道如何做这个。
看起来默认值为 20 像素,但我希望将其提高,因此长度为 1 个时隙的事件将能够显示事件标题和正文。当前,当事件长度为 1 个时隙时,仅显示事件标题。 最佳答案 任何仍在寻找新版本答案的人。 在新版本
我正在尝试实现 this solution在 Fullcalendar 中“变灰”过去的事件,但我没有任何运气。不过,我不太精通 Javascript,所以我认为我犯了一些愚蠢的错误。 我已经将建议的
我使用 jQuery fullCalendar (http://arshaw.com/fullcalendar/docs/selection/unselectAuto/) 我使用这个日历的可选版本 (
这看起来非常简单,但我花了半天时间把头撞在墙上,试图弄清楚为什么我的全日历事件只显示在 77 像素,而单元格(月 View )的宽度似乎是 90 像素或更高。我曾尝试修改 fc-event css 规
我正在尝试在全日历中将时间格式更改为 24 小时制。 我试图找到它 here但我无法弄清楚。 这里的代码片段: jQuery('#calendar').fullCalendar({ heade
在月 View 中 fullcalendar 有一个很好的功能,可以在非全天事件的顶行显示开始时间。如果您不想在事件标题中提供更多详细信息,这可能很有用。 我想在月 View 中显示几个详细信息,例如
如何在 fullcalendar 中显示事件的描述? 我有具有标题和描述的事件。 那么如何显示描述呢? 最佳答案 当您添加标题和描述时,它将连接起来。 使用以下代码,您可以连接标题: eventRen
我正在尝试使用 FullCalendar 在网页上呈现 Google 日历中的事件。我想要开始日期/时间、描述和地点。 future 事件在一个 div 中,过去事件在另一个 div 中。 现在,我的
我正在尝试突出显示 FullCalender.io 中的选定日期(与当前日期类似)。 已关注 FullCalendar - Highlight a particular day in week vie
我是 FullCalendar 新手。在我的项目中,我需要显示带有时间范围的日历以及每天为每个培训中心分配的参与者。更准确地说,一天可以有很多个培训时段,由培训中心进行。因此,我想展示哪个培训中心分配
我是一名优秀的程序员,十分优秀!