Default values for custom event fields?

Hi,

where can I set default values for custom event fields?

In the documentation I can only find how to set them for standard fields: https://ej2.syncfusion.com/react/documentation/schedule/appointments/#event-field-settings


1 Reply

VD Vinitha Devi Murugan Syncfusion Team July 30, 2021 05:05 AM UTC

Hi Laurin, 
 
Greetings from Syncfusion Support. 
 
We have validated your reported query “where can I set default values for custom event fields” and achieved your requirement by using popupOpen event of our scheduler. We have prepared below sample for your reference.  
 
 
 onPopupOpen(args) { 
    if (args.type === 'Editor') { 
      // Create required custom elements in initial time 
      if (!args.element.querySelector('.custom-field-row')) { 
        let row = createElement('div', { className: 'custom-field-row' }); 
        let formElement = args.element.querySelector('.e-schedule-form'); 
        formElement.firstChild.insertBefore( 
          row, 
          formElement.firstChild.firstChild 
        ); 
        let container = createElement('div', { 
          className: 'custom-field-container' 
        }); 
        let inputEle = createElement('input', { 
          className: 'e-field custom-dropdown', 
          attrs: { name: 'EventType' } 
        }); 
        container.appendChild(inputEle); 
        row.appendChild(container); 
        let drowDownList = new DropDownList({ 
          dataSource: [ 
            { text: 'Public Event'value: 'public-event' }, 
            { text: 'Maintenance'value: 'maintenance' }, 
            { text: 'Commercial Event'value: 'commercial-event' }, 
            { text: 'Family Event'value: 'family-event' } 
          ], 
          fields: { text: 'text'value: 'value' }, 
          value: args.data.EventType, 
          floatLabelType: 'Always', 
          placeholder: 'Event Type' 
        }); 
        drowDownList.appendTo(inputEle); 
        inputEle.setAttribute('name''EventType'); 
      } 
      if (args.target.classList.contains('e-work-cells')) { 
        args.element.querySelector( 
          '.custom-dropdown' 
        ).ej2_instances[0].index = 0; 
      } 
    } 
  } 
 
Kindly try with the above sample and get back to us if you need any further assistance. 
 
Regards, 
Vinitha 


Loader.
Up arrow icon