Ej2 Schedule: How to access Title field when popup open so I can pre-fill that Title with custom value

Hello,

I have default editing window for Schedule (I'm not using template). When add new event, how to access title field when (before) popup open, so I can pre-fill that Title with custom value such as number sequence from my internal number sequence generator API:



Thank you in advance,

Best regards,

Ismail


3 Replies

PN Praveenkumar Narasimhanaidu Syncfusion Team August 30, 2021 09:20 AM UTC

Hi Ismail, 

Greetings from Syncfusion support..! 

We have validated the your reported query “How to access Title field when popup open so I can pre-fill that Title with custom value” at our end. We let you know that, you can pre-fill Title with custom value using property named default within eventSettings. Please refer following UG link for more information. 


   subject: { name: 'TravelSummary', title: 'Summary', default: 'Add Summary' }, 

Kindly try the above solution and let us know if this meets your requirement. 

Regards, 
Praveenkumar 



IH ISMAIL HAMZAH replied to Praveenkumar Narasimhanaidu August 30, 2021 01:50 PM UTC

Hello Praveen,


Thank you for your update. I can not use your suggestion because I can not fill the default property with callback function. 


I have found a way, its working, but not sure this is the best approach. Could you please check my code below:

note:

The idea is I intercept using popupOpen, then to distinguish new quick info or new editor, I check the args.data.Guid is null or not by using ej.base.isNullOrUndefined(args.data.Guid). Is it correct? please give me feedback


        popupOpen: (args) => {


            var guid = args.data.Guid;

            if (args.name === 'popupOpen' && (args.type === 'Editor' || args.type === 'QuickInfo') && ej.base.isNullOrUndefined(guid)) {


                indo.numberSequences.numberSequence

                    .getNextNumber(16)

                    .then(function (data) {

                        if (args.type === 'QuickInfo') {

                            var input = document.getElementsByClassName('e-subject e-field e-input');

                            input[0].value = data;

                        }

                        if (args.type === 'Editor') {

                            document.getElementById('name').value = data;

                        }

                        args.data.IsAllDay = false;

                    });


            }


Best regards,

Ismail



NR Nevitha Ravi Syncfusion Team August 31, 2021 05:04 AM UTC

Hi Ismail, 

Thanks for your update. 

Yes, you can use popupOpen event if the value is assigned through callback function. 

Please get back to us if you need any further assistance. 

Regards, 
Nevitha 


Loader.
Up arrow icon