how to add an addtion all field in args.data

I am trying to add courseId to the args.data got from the event when an action is called when I use the .addEvent() function it works but if I use the open editor it does 
How can  I work around this 

1 Reply 1 reply marked as answer

RV Ravikumar Venkatesan Syncfusion Team March 8, 2021 11:50 AM UTC

Hi Isaac, 

Greetings from Syncfusion support. 

We have validated your reported query at our end and suspect that you are using the external drag and drop with the Schedule. When adding data directly using the addEvent method the passed data is saved the whole data as we passed. But, when passing the same data to the openEditor method the input fields need to present in the editor window to save the whole data passed to the editor window. Otherwise, the data is added based on the input fields available in the editor window. 

In the below sample we have passed a courseId value to the openEditor method. The data is added to the Schedule on save action. Because the input field is present for the courseId field in the editor window. 


[index.js] 
  onTreeDragStop(event) { 
    let treeElement = closest(event.target, ".e-treeview"); 
    if (!treeElement) { 
      event.cancel = true; 
      let scheduleElement = closest(event.target, ".e-content-wrap"); 
      if (scheduleElement) { 
        let treeviewData = this.treeObj.fields.dataSource; 
        if (event.target.classList.contains("e-work-cells")) { 
          const filteredData = treeviewData.filter(item => item.Id === parseInt(event.draggedNodeData.id, 10)); 
          let cellData = this.scheduleObj.getCellDetails(event.target); 
          let resourceDetails = this.scheduleObj.getResourcesByIndex(cellData.groupIndex); 
          // In the below data we have added the custom value when adding this data through openEditor method the editor window doesn't contain the input field for the custom value. So, this value is not added to the Schedule data. To add this data you need to add the input field for this custom value inside the editor window 
          let eventData = { 
            title: filteredData[0].Name, 
            startTime: cellData.startTime, 
            endTime: cellData.endTime, 
            courseId: resourceDetails.resourceData.Id, 
            custom: "Custom" 
          }; 
          this.scheduleObj.openEditor(eventData, "Add", true); 
        } 
      } 
    } 
  } 

Note: When performing the save action from the editor window the data added to the Schedule is formed based on the input fields available in the editor window. So, it doesn’t consider the other data are 
passed to the openEditor method. If you want to add the additional data to the Schedule data we suggest you to add the additional fields to the Schedule editor window in the following ways. 

  1. UG(Add additional fields with the default editor): https://ej2.syncfusion.com/react/documentation/schedule/editor-template/#add-additional-fields-to-the-default-editor
  2. UG(Use editor template to add additional fields to editor window): https://ej2.syncfusion.com/react/documentation/schedule/editor-template/#customizing-event-editor-using-template

Kindly try the above solution and get back to us if you need any further assistance. 

Regards, 
Ravikumar Venkatesan 


Marked as answer
Loader.
Up arrow icon