Hey guys!
I followed the docs and tutorial and tried for weeks, but something seems wrong with the remote data implementation on my side, I would really like your help on that.
I'm using a post request with axios as followed in the code I attached, which gets array of dictionaries with the required fields inside. including resourceId's.
I'm using typescript in a tsx file and react in a class component and fetching the data from my api I developed, nothing crazy.
**Code in zip file attached - sorry for the inconvenience with the photos
Thanks in advance !!
Attachment: photos_1b0b17d9.rar
Upppp!
|
onBound(args) {
if (this.flag) {
axios.get('http://localhost:54738/Home/GetData').then(response => {
var schObj = document.querySelector('.e-schedule').ej2_instances[0];
schObj.eventSettings.dataSource = response.data;
});
this.flag = false;
}
}
onBegin(args) {
if (args.requestType === 'eventCreate') {
axios
.post('http://localhost:54738/Home/Insert', args.data[0])
.then(response => {
var schObj = document.querySelector('.e-schedule').ej2_instances[0];
schObj.eventSettings.dataSource = response.data;
});
} else if (args.requestType === 'eventChange') {
axios
.post('http://localhost:54738/Home/Update', args.data)
.then(response => {
var schObj = document.querySelector('.e-schedule').ej2_instances[0];
schObj.eventSettings.dataSource = response.data;
});
} else if (args.requestType === 'eventRemove') {
axios
.post('http://localhost:54738/Home/Delete', args.data[0])
.then(response => {
var schObj = document.querySelector('.e-schedule').ej2_instances[0];
schObj.eventSettings.dataSource = response.data;
});
}
} |
Hey, im using tsx like your tutorial in youtube.
Do you have a tsx version of exactly this? thank you so much!
And where do you define the datasource in the class component?
We have prepared React TSX sample for your reference which can be available from the below link. You can define the datasource anywhere in the Class component and can use it through this variable.
Sample: https://stackblitz.com/edit/ej2-react-tsx-schedule-app-customization-7o59ot?file=package.json
Hey ty so much, I managed to get it with jsx functional component, it only works without resource. When I add groupData of resources. data is dissapearing... im saving the resource ids in the db with the tasks from args.data. please help with that :)
its actually the groupdata which ruins it for me , im attaching groupData as followed in the video
Can you please share your scheduler related code snippet along with the package version and error messages that you have faced while adding groupData? It will be very helpful to validate the issue and provide a prompt solution ASAP?
Hey! I got it to work, the problem was the resourceId was passed as a string to the db instead of integer.
Now I have a custom dropdown I made in the editor window of mission status. I want to have a green background when mission is complete, and red when not etc. I managed to color all missions on click but not a specific one.. any help on that ?
ty so much!
We have achieved your requirement by using eventRendered and popupOpen events of the Scheduler like the below code snippet.
|
private onEventRendered(args) { switch (args.data.EventType) { case 'completed': args.element.style.backgroundColor = 'green'; break; case 'onhold': args.element.style.backgroundColor = 'yellow'; break; case 'rejected': args.element.style.backgroundColor = 'red'; break; } } private onPopupOpen(args: PopupOpenEventArgs): void { if (args.type === 'Editor') { // Create required custom elements in initial time if (!args.element.querySelector('.custom-field-row')) { let row: HTMLElement = createElement('div', { className: 'custom-field-row' }); let formElement: HTMLElement = args.element.querySelector('.e-schedule-form'); formElement.firstChild.insertBefore(row, formElement.firstChild.firstChild); let container: HTMLElement = createElement('div', { className: 'custom-field-container' }); let inputEle: HTMLInputElement = createElement('input', { className: 'e-field', attrs: { name: 'EventType' } }) as HTMLInputElement; container.appendChild(inputEle); row.appendChild(container); let dropDownList: DropDownList = new DropDownList({ dataSource: [ { text: 'Completed', value: 'completed' }, { text: 'Onhold', value: 'onhold' }, { text: 'Rejected', value: 'rejected' } ], fields: { text: 'text', value: 'value' }, value: args.data.EventType as string, floatLabelType: 'Always', placeholder: 'Chosse event Type' }); dropDownList.appendTo(inputEle); inputEle.setAttribute('name', 'EventType'); } } } |
Sample: https://stackblitz.com/edit/ej2-react-tsx-schedule-app-customization-ycjusf?file=index.tsx
Kindly refer and follow the above solution and let us know if this is helpful.
Thank you so much mate!
I’m trying to implement weather by user input in the header of each day.
I added an input of weather type in the modal editor. Now I want the weather that the user inputed be in each header related to the day he picked when editing/creating a mission in the modal window.
I saw the weather in case of day in your docs. Could figure out how to make it related to the editor window modal and weather type field I added there.
Thanks in advance!!!
Hi Yosi,
We can have the WeatherType in the editor window by using the editorTemplate
property of the Scheduler like the below sample.
Code snippet:
|
editorTemplate(props) { . . . . . . <DropDownListComponent id="WeatherType" placeholder='Choose weather' data-name='WeatherType' className="e-field" style={{ width: '100%' }} dataSource={['Cloudy', 'Rainy', 'Clear']}> </DropDownListComponent> . . . . . . } . . . . . . . . . </ScheduleComponent> |
Sample: https://stackblitz.com/edit/react-rcjvvu
UG: https://ej2.syncfusion.com/react/documentation/schedule/editor-template/#customizing-event-editor-using-template
Kindly try the above solution and let us know if this meets your requirement.
Regards,
Balasubramanian S
Hey, ty for the fast answer!
I want to put user input of weather in header. If he picks rainy I put rainy photo on the header of that day.
I managed to make the dropdown list with the weather options. My problem is displaying the weather in the header, according to the day picked.
I’m using tsx stateless component and having hard time with the class example unfortunately.
Would appreciate your help!! Ty so much
Hi Yosi,
We regret to let you know that your requirement with the DateHeader is not feasible at our end according to the Scheduler architecture.
Kindly create a new thread if you have any other queries. We will be happy to assist you.
Regards,
Balasubramanian S