We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Items disappear when switching between month-week-day view

Hi,

I'm using the SFSchedule in a DataBinding technique.

As it shown in your samples, I'm using the ItemsResource property to bind my collection.

The item are displayed just fine in a month view, but when I switch to week or day view, they disappear.

Any ideas ?..

Thanks,

Kesem


11 Replies

JO Joy Oyiess Rex  K Syncfusion Team March 19, 2014 05:17 AM UTC

Hi Kesem,

 

Thanks for your interest in Syncfusion products.

 

Based on the provided information, your requirement is to bind the custom data collection with the ItemsSource property of the SfSchedule.  We have created a simple sample for the same. Please find the sample in the attachment.

 

And we are not able reproduce the mentioned issue when switching between schedule views (ScheduleType) for the please refer the attached sample.

 

If the provided solution doesn’t meet your requirement, please revert us back with more information by modifying the provided sample, so that we could analyse on it and provide you better solution.

 

Please let us know, if you need any further assistance.

 

Regards,

Joy Oyiess Rex K


Attachment: AppointmentMapping_SfSchedule_WinRT_11a0520b.zip


KZ Kesem Zur-Korakin March 20, 2014 08:45 PM UTC

I'm following your sample, but still have some issues.

Seems that my recurrence events won't show on day/week view, but will show on month view.

I'm not using the recurrence feature in the SFSchedule, as it didn't work for me (no option to edit it using my own editor). I am duplicating the recurrence events, so eventually each event is a single event on the scheduler.

Still, only those events, who were duplicated, will not shown on any view but the monthly view. All other events will show on all the views.

I can't seem to find any difference between the two Items in the ItemsSource...

Further investigation shows that the event that are not shown raise the following exception (that might explain whey they are disappear from the scheduler).

Error: Converter failed to convert value of type 'Boolean' to type 'Brush'; BindingExpression: Path='MinorTickLabelStroke' DataItem='Syncfusion.UI.Xaml.Schedule.SfSchedule'; target element is 'Syncfusion.UI.Xaml.Schedule.ScheduleDaysView' (Name='null'); target property is 'MinorTickLabelStroke' (type 'Brush').

Any ideas ?

Thanks,

Kesem



JO Joy Oyiess Rex  K Syncfusion Team March 21, 2014 09:47 AM UTC

Hi Kesem,

 

Thanks for your update.

 

#Regarding duplicating the recurrence events

 

Could you please provide us a simple sample or code snippet for the mentioned scenario, so that we could analyse on it and provide you better solution.

 

# Regarding DataBinding Issue

 

We have already noted the mentioned issue and fixed it. The fix for this issue will be available in our upcoming volume release, Volume 1 Mar 2014, which is estimated to be available by the end of this month.

 

Please let us know, if you have any concerns.

 

Thanks,

Joy Oyiess Rex K



KZ Kesem Zur-Korakin March 21, 2014 04:23 PM UTC

Please find the following example.

Seems that the event will show on the other views (weekly, daily), but the exception still raised.

On my original code, which is doing about the same, the events will not appear on any other views but the monthly view.

Any ideas what I am doing wrong ?

Thanks,

Kesem


Attachment: RecurrenceEvents_SfSchedule_WinRT.v11_2b3b90b1.zip


JO Joy Oyiess Rex  K Syncfusion Team March 24, 2014 12:31 PM UTC

Hi Kesem,

Thanks for your previous update.

From the provided sample, we are not able to reproduce the mentioned issue, (i.e.,) we are able to view the appointments on all the views.

We suspect that the mentioned issue is due to StartTime and EndTime of the Appointment  might  be same. Based on the implementation of Schedule control, appointments in the Month View doesn’t depends on timespan like the other views, so we are able to view zero duration appointment in MonthView alone(but not in the other views).

If the provided solution doesn’t meet you requirement, please revert us back with more information by modify the provided sample to reproduce the issue. So that we could analyse on it and provide you better solution.

Along with the above requested information, could you please provide us more information about your requirement of  what kind of properties which you need to be modified in those recurrence appointment?

Regards,
Joy Oyiess Rex K



KZ Kesem Zur-Korakin March 24, 2014 06:01 PM UTC

Thanks! Those calendar items were, indeed, reminders so the start and end time was the same.

I put a minimal duration time, and this has solved the issue.

I still get the exception






Error: Converter failed to convert value of type 'Boolean' to type 'Brush'; BindingExpression: Path='MinorTickLabelStroke' DataItem='Syncfusion.UI.Xaml.Schedule.SfSchedule'; target element is 'Syncfusion.UI.Xaml.Schedule.ScheduleDaysView' (Name='null'); target property is 'MinorTickLabelStroke' (type 'Brush').

 Will this is solved on the next version ? (This is only for weekly/daily views).

As for recurrence events - I will need to allow editing all the properties (start time, end time, attendees, message, location, etc.. ), but I also need some sort of notification that the event was changed. Right now you don't provide such notification (for neither recurrence or one-time events), and for that reason I'm using my own custom editor.

Thanks,

Kesem



JO Joy Oyiess Rex  K Syncfusion Team March 25, 2014 12:04 PM UTC

Hi Kesem,

 

Thanks for your update,

 

We are glad to hear that the issue resolved.

 

Regarding  Binding issue

 

 As mentioned earlier , we have already noted the mentioned issue  and fixed it. The fix for this issue will be available in our upcoming volume release, Volume 1 Mar 2014, which is estimated to available in a week.

 

Regarding  Recurrence Appointments

 

We are currently analysing on this, we will let you know the details in two business days (Mar 27, 2014).

 

Please let us know, if you need any further assistance.

 

Regards,

Joy Oyiess Rex K



JO Joy Oyiess Rex  K Syncfusion Team March 27, 2014 11:11 AM UTC

Hi Kesem,

 

We appreciate your patience.

 

We have analysed your requirement of notifying when some properties of an appointment changed, we are able to achieve this requirement, through the “EditedAppointment” and “OriginalAppointment” event arguments, which we have implemented in the AppointmentEditorClosed event of the SfSchedule, this support will be available from our upcoming volume release ( Volume 1 2014). It is estimated to be available in a week.

 

Please let us know, if you need any further assistance.

 

Regards,

Joy Oyiess Rex K



OS Open Source March 14, 2024 02:58 PM UTC

I am facing the same issue. Month and Day view work fine however when I switch to Week view it does not show the records. When I test with static records it works fine. Please let me know where I am doing mistake here: 

/* eslint-disable-next-line react/no-multi-comp */
/* eslint-disable max-classes-per-file */
/* eslint-disable react/no-unused-state */
import * as React from "react";
import { toast } from "react-toastify";
import common from "../../../services/common";
import {
Button,
Row,
Col,
Spinner,
Modal,
ModalHeader,
ModalBody,
ModalFooter,
} from "reactstrap";
import CaseDetailsBody from "../Cases/CaseDetailsBody";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import LoadingOverlay from "react-loading-overlay";
import { connect } from "react-redux";

import {
Inject,
ScheduleComponent,
ViewsDirective,
ViewDirective,
Day,
Week,
Month,
Resize
} from "@syncfusion/ej2-react-schedule";
import moment from "moment";

import "../../../../node_modules/@syncfusion/ej2-base/styles/material.css";
import "../../../../node_modules/@syncfusion/ej2-buttons/styles/material.css";
import "../../../../node_modules/@syncfusion/ej2-calendars/styles/material.css";
import "../../../../node_modules/@syncfusion/ej2-dropdowns/styles/material.css";
import "../../../../node_modules/@syncfusion/ej2-inputs/styles/material.css";
import "../../../../node_modules/@syncfusion/ej2-lists/styles/material.css";
import "../../../../node_modules/@syncfusion/ej2-navigations/styles/material.css";
import "../../../../node_modules/@syncfusion/ej2-popups/styles/material.css";
import "../../../../node_modules/@syncfusion/ej2-splitbuttons/styles/material.css";
import "../../../../node_modules/@syncfusion/ej2-react-schedule/styles/material.css";
import { TreeViewComponent } from "@syncfusion/ej2-react-navigations";
import scheduler from "../../../services/scheduler";
import Badge from "reactstrap/lib/Badge";
import Form from "reactstrap/lib/Form";
import Input from "reactstrap/lib/Input";

class Scheduler extends React.Component {
constructor(props) {
super(props);
this.state = {
activeLocation: this.props.defaultLocation,
events: [],
locations: [],
draggedEvent: null,
showPopup: true,
eventLoader: false,
showCaseModal: false,
showAddEditModal: false,
droppedData: null,
formData: null,
deleteLoder: false,
currentDate: new Date(moment()),
startDayHour: "08:00",
endDayHour: "20:00",
blockedDetail: null,
slotLoader: false,
currentView: "Week",
fields: [
{
Id: 1,
Subject: "NO APPOINTMENT",
StartTime: "2018-09-03T02:00:00.000Z",
EndTime: "2018-09-03T04:00:00.000Z",
},
],
colorCodes: ['#1eb653', '#faea12', '#e83e8c', '#3254eb', '#ca0cdb', '#c14018', '#0fbd99', '#2f353a', '#026112', '#da0704', '#808080']
};
}
resetEvent = (id) => {
let events = this.state.events;
if (window.confirm("Are you sure?")) {
let event_to_be_removed = events.map((event) => event.id).indexOf(id);
events.splice(event_to_be_removed, 1);
this.setState({ events, showPopup: false });
}
};

onTreeDragStop = (e) => {
if (typeof this.scheduleObj.getCellDetails(e.target) !== "undefined") {
this.setState({ showAddEditModal: true, droppedData: e.target });
}
};

componentDidMount() {
this.setState({ eventLoader: true });
this.getEvents(this.props.defaultLocation);
common.getUserLocations().then((response) => {
if (response.data.locations) {
let eventLocations = response.data.locations.map((loc) => loc);
let locations = eventLocations.filter(
(item, i, ar) => ar.map((c) => c.id).indexOf(item.id) === i
);
this.setState({ locations });
}
});
}

componentDidUpdate = (prevProps, prevState) => {
if (
// moment(prevState.currentDate).format("MMMM") !==
// moment(this.state.currentDate).format("MMMM") ||
//* NOT REQURIRED AS change of date is calling events list already
prevProps.defaultLocation !== this.props.defaultLocation ||
prevState.currentView !== this.state.currentView ||
prevState.currentDate !== this.state.currentDate
) {
this.getEvents(this.state.activeLocation);
}
};

toggleCaseModal = (id) => {
let caseId = id !== undefined ? id : "";
this.setState((prevState) => ({
caseId,
showCaseModal: !prevState.showCaseModal,
}));
};

toggleAditEditModal = (id) => {
let caseId = id !== undefined ? id : "";
this.setState((prevState) => ({
caseId,
showAddEditModal: !prevState.showAddEditModal,
formData: null,
blockedDetail: null,
}));
};

deleteBlockedSlots = () => {
this.setState({ deleteLoder: true });
scheduler.delete({ id: this.state.caseId }).then((res) => {
if (res.data.success) {
toast.success(res.data.message, {
position: toast.POSITION.TOP_RIGHT,
});
this.getEvents(this.state.activeLocation);
this.toggleAditEditModal();
this.setState({
formData: null,
blockedDetail: null,
});
}
this.setState({ deleteLoder: false });
});
};

getEvents = (id) => {
let events = [];
this.setState({ eventLoader: true, activeLocation: id });
scheduler
.getCaseList({
fields: {
location_id: id,
currentDate: moment(this.state.currentDate).format("YYYY-MM-DD"),
view: this.state.currentView,
},
})
.then((response) => {
if (response.data.success) {
response.data.cases.forEach(c => {
events.push({
Id: c.id,
Subject: common.getFullName(c.patient),
StartTime: new Date(c.appointment_date + " " + c["slot"].from_time),
EndTime: new Date(c.appointment_date + " " + c["slot"].to_time),
CategoryColor: this.state.colorCodes[c.status],
});
});

response.data.blocked.forEach(b => {
events.push({
Id: b.id,
Subject: b.subject,
StartTime: new Date(b.appointment_date + " " + b.from_time),
EndTime: new Date(b.appointment_date + " " + b.to_time),
CategoryColor: "#808080",
type: "blocked",
});
});
/* events.push(
{
Id: 1,
Subject: "New Year",
StartTime: new Date("2024-03-12 09:00"),
EndTime: new Date("2024-03-12 09:30"),
},
{
Id: 2,
Subject: "May Day",
StartTime: new Date("2024-03-15 11:00"),
EndTime: new Date("2024-03-15 11:30"),
},
{
Id: 3,
Subject: "Bering Sea Gold",
StartTime: new Date("2024-03-16 14:00"),
EndTime: new Date("2024-03-16 14:30"),
}
) */
this.setState({ data: events });
}
this.setState({ eventLoader: false });
});
};

onPopupOpen = (args) => {
args.cancel = true;
if (args.data.Id && args.data.type !== "blocked") {
this.toggleCaseModal(args.data.Id);
} else if (args.data.Id && args.data.type === "blocked") {
this.toggleAditEditModal(args.data.Id);
this.getBlockedDetail(args.data.Id);
} else if (args.data.event) {
args.cancel = false;
}
};

getBlockedDetail = (id) => {
this.setState({ slotLoader: true });
let params = { id: id };
scheduler
.getOne(params)
.then((response) => {
if (response.data.success) {
this.setState({
blockedDetail: response.data.form,
formData: response.data.form.subject,
slotLoader: false,
});
}
})
.catch(function (error) {
this.setState({ error_403: true });
});
};

onEventRendered = (args) => {
if (args) {
args.element.style.backgroundColor = args.data.CategoryColor;
}
};

handleChange = (e) => {
this.setState({ formData: e.target.value });
};

handleSubmit = (e) => {
e.preventDefault();
let fields = {};
let eventData = {};
let cellData = this.scheduleObj.getCellDetails(this.state.droppedData);
if (this.state.blockedDetail) {
fields = {
id: this.state.blockedDetail.id,
user_id: this.props.userId,
location_id: this.state.activeLocation,
subject: this.state.formData,
appointment_date: this.state.blockedDetail.appointment_date,
from_time: this.state.blockedDetail.from_time,
to_time: this.state.blockedDetail.to_time,
full_day_off:
this.state.blockedDetail.from_time === "08:00:00" &&
this.state.blockedDetail.to_time === "20:00:00"
? "1"
: "0",
};
eventData = {
Subject: this.state.formData,
StartTime: this.state.blockedDetail.from_time,
EndTime: this.state.blockedDetail.to_time,
// IsAllDay: cellData.isAllDay,
// IsBlock: true,
};
} else if (cellData.startTime.toLocaleTimeString() === "12:00:00 AM") {
fields = {
user_id: this.props.userId,
location_id: this.state.activeLocation,
subject: this.state.formData,
appointment_date: cellData.startTime.toLocaleDateString("zh-Hans-CN"),
from_time: "08:00:00",
to_time: "20:00:00",
full_day_off: "1",
};
eventData = {
Subject: this.state.formData,
StartTime: cellData.startTime,
EndTime: cellData.endTime,
IsAllDay: cellData.isAllDay,
// IsBlock: true,
};
} else {
fields = {
user_id: this.props.userId,
location_id: this.state.activeLocation,
subject: this.state.formData,
appointment_date: cellData.startTime.toLocaleDateString("zh-Hans-CN"),
from_time: cellData.startTime.toLocaleTimeString(),
to_time: cellData.endTime.toLocaleTimeString(),
};
eventData = {
Subject: this.state.formData,
StartTime: cellData.startTime,
EndTime: cellData.endTime,
IsAllDay: cellData.isAllDay,
// IsBlock: true,
};
}
scheduler.add({ fields: fields }).then((res) => {
this.getEvents(this.state.activeLocation);
if (res.data.success) {
toast.success(res.data.message, {
position: toast.POSITION.TOP_RIGHT,
});
this.setState({
showAddBlockedModal: false,
formData: null,
blockedDetail: null,
});
this.scheduleObj.addEvent(eventData);
} else {
toast.error(res.data.message, {
position: toast.POSITION.TOP_RIGHT,
});
}
});
this.toggleAditEditModal();
};

onresizeStart = (args) => {
if (args.data.CategoryColor !== "#808080") {
args.cancel = true;
}
};

onresizeStop = (args) => {
if (args.data.CategoryColor !== "#808080") {
args.cancel = true;
}
let fields = {
id: args.data.Id,
user_id: this.props.userId,
location_id: this.state.activeLocation,
subject: args.data.Subject,
appointment_date: args.data.StartTime.toLocaleDateString("zh-Hans-CN"),
from_time: args.data.StartTime.toLocaleTimeString(),
to_time: args.data.EndTime.toLocaleTimeString(),
full_day_off:
args.data.StartTime.toLocaleTimeString() === "8:00:00 AM" &&
args.data.EndTime.toLocaleTimeString() === "8:00:00 PM"
? "1"
: "0",
};
let eventData = {
Subject: args.data.Subject,
appointment_date: args.data.StartTime.toLocaleDateString("zh-Hans-CN"),
StartTime: args.data.StartTime.toLocaleTimeString(),
EndTime: args.data.EndTime.toLocaleTimeString(),
// IsAllDay: cellData.isAllDay,
// IsBlock: true,
};
scheduler.add({ fields: fields }).then((res) => {
this.getEvents(this.state.activeLocation);
if (res.data.success) {
toast.success(res.data.message, {
position: toast.POSITION.TOP_RIGHT,
});
}
});
this.scheduleObj.addEvent(eventData);
};

render() {
const { currentDate, data, startDayHour, endDayHour } = this.state;
return (
<div>
<Row>
<Col sm={2} />
<Col sm={10}>
{this.state.locations.map((loc, i) => (
<Button
color="primary"
outline={
parseInt(this.state.activeLocation) !== parseInt(loc.id)
}
key={i}
className={
parseInt(this.state.activeLocation) === parseInt(loc.id)
? "mr-3 mb-3 active"
: "mr-3 mb-3"
}
onClick={() => this.getEvents(loc.id)}
>
{loc.publish_name}
</Button>
))}
</Col>
</Row>
<Row>
<Col sm={2}>
<div style={{ position: 'fixed' }}>
<div>
<h5 className="m-b-15">Draggable Event</h5>
<span>
<TreeViewComponent
fields={{
dataSource: this.state.fields,
id: "Id",
text: "Subject",
}}
allowDragAndDrop
nodeDragStop={this.onTreeDragStop}
className="no-appointment"
/>
</span>
</div>
<div>
<h5 className="pt-5">
<Badge color="primary" className="p-1 caseStatus-0">
New Cases
</Badge>
</h5>
<h5>
<Badge color="primary" className="p-1 caseStatus-1">
Patient Checked-in
</Badge>
</h5>
<h5>
<Badge color="primary" className="p-1 caseStatus-2">
Patient Paper work uploaded
</Badge>
</h5>
<h5>
<Badge color="primary" className="p-1 caseStatus-3">
Payment Accepted
</Badge>
</h5>
<h5>
<Badge color="primary" className="p-1 caseStatus-4">
Records captured
</Badge>
</h5>
<h5>
<Badge color="primary" className="p-1 caseStatus-5">
Re-formated files uploaded
</Badge>
</h5>

<h5>
<Badge color="primary" className="p-1 caseStatus-6">
Ready for Radiologist
</Badge>
</h5>
<h5>
<Badge color="primary" className="p-1 caseStatus-7">
Rad Report Completed
</Badge>
</h5>
<h5>
<Badge color="primary" className="p-1 caseStatus-8">
Case Completed
</Badge>
</h5>
<h5>
<Badge color="primary" className="p-1 caseStatus-10">
Blocked
</Badge>
</h5>
</div>
</div>
</Col>
<Col sm={10}>
<LoadingOverlay
active={this.state.eventLoader}
spinner={<Spinner color="dark" />}
fadeSpeed={200}
classNamePrefix="mitiz"
>
<ScheduleComponent
ref={(schedule) => (this.scheduleObj = schedule)}
popupOpen={this.onPopupOpen}
eventSettings={{ dataSource: this.state.data }}
navigating={(e) => {
this.setState({
currentDate: e.currentDate,
currentView: e.currentView
? e.currentView
: this.state.currentView,
});
}}
eventRendered={this.onEventRendered}
resizeStart={this.onresizeStart}
resizeStop={this.onresizeStop}
currentView={"Week"}
>
<ViewsDirective>
<ViewDirective
option="Day"
startHour={startDayHour}
endHour={endDayHour}
/>
<ViewDirective
option="Week"
startHour={startDayHour}
endHour={endDayHour}
/>
<ViewDirective option="Month" />
</ViewsDirective>
<Inject services={[Month, Week, Day, Resize]} />
</ScheduleComponent>
</LoadingOverlay>
</Col>
</Row>
{this.state.showCaseModal && (
<Modal isOpen={this.state.showCaseModal} size="xl">
<ModalBody className="p-1">
<CaseDetailsBody
caseId={this.state.caseId}
enableEditCase={true}
enableBackCase={this.toggleCaseModal}
toggle={() => {
this.setState({ showCaseModal: false });
this.getEvents(this.state.activeLocation);
}}
/>
</ModalBody>
</Modal>
)}
{this.state.showAddEditModal && (
<Modal isOpen={this.state.showAddEditModal}>
<LoadingOverlay
active={this.state.slotLoader}
spinner={<Spinner color="dark" />}
fadeSpeed={200}
classNamePrefix="mitiz"
>
<ModalHeader>Update Label</ModalHeader>
<Form onSubmit={this.handleSubmit}>
<ModalBody style={{ fontSize: 18 }}>
<Input
type="text"
onChange={(e) => this.handleChange(e)}
value={this.state.formData ? this.state.formData : ""}
placeholder="Enter Label"
/>
</ModalBody>
<ModalFooter>
<Button
type="button"
color="secondary"
size="md"
onClick={this.toggleAditEditModal}
>
Cancel
</Button>
{this.state.blockedDetail && this.state.blockedDetail.id && (
<Button
type="button"
color="danger"
size="md"
disabled={this.state.deleteLoder}
onClick={this.deleteBlockedSlots}
>
{this.state.deleteLoder && (
<FontAwesomeIcon
icon="spinner"
className="mr-1"
spin={true}
/>
)}
Delete
</Button>
)}
<Button size="md" color="success" type="submit">
{this.state.blockedDetail && this.state.blockedDetail.id
? "Update"
: "Save"}
</Button>
</ModalFooter>
</Form>
</LoadingOverlay>
</Modal>
)}
</div>
);
}
}

const mapStateToProps = (state) => {
return {
defaultLocation: state.defaultLocation,
userId: state.userId,
};
};
export default connect(mapStateToProps)(Scheduler);



OS Open Source March 14, 2024 03:01 PM UTC

You may check the below look video to understand the view. 

https://www.loom.com/share/70356f40f4fd4587ab88d8992e7e3f1c



RS Raghavendra Sudhakar Syncfusion Team March 20, 2024 05:05 AM UTC

Hi Kesem Zur-Korakin,


We have created a separate forum thread under your account, please follow the below forum thread for further updates. 

Items disappear when switching between month-week-day view - from 116023 | JavaScript - EJ 2 Forums | Syncfusion


Regards,

Raghavendra S



Loader.
Live Chat Icon For mobile
Up arrow icon