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. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Changing the value in an already created item

Thread ID:

Created:

Updated:

Platform:

Replies:

144446 May 7,2019 06:36 AM UTC May 9,2019 03:40 AM UTC Vue 3
loading
Tags: Schedule
Vadims Talapins
Asked On May 7, 2019 06:36 AM UTC

I had a problem changing the value. In one method when a form is created, I create a DateTimePicker. Also in the form there are buttons like time templates, when clicked, the template time should be set by template . When pressed, the value changes visually, but after submitting the form, the value is set to the original :(.
var editorTemplateVue = Vue.component('editorTemplate', {
template: `

<span class="button is-success is-selected" v-on:click="changeDate('1')">8:00 - 16:00</span>
     <input id="StartTime" ref="starttime" class="e-field" type="text" name="StartTime" />

`
,
data: function() {
return {
};
},

methods: {
changeDate: function (data) {
     let startDate = this.$refs.starttime.value;
     startDate = startDate.split(" ");
      this.$refs.startDate.value = endDate[0] + ' 16:00 ' + 'PM';

     },

}
},
}


export default Vue.extend({
data: function () {
return {

editorTemplate: function(e) {
return {
template: editorTemplateVue
}
}},
methods: {
onPopupOpen: function(args) {
if (args.type === 'Editor') {
let startElement = args.element.querySelector('#StartTime');

if (!startElement.classList.contains('e-datetimepicker')) {

let testtt = new DateTimePicker(
{value: new Date(startElement.value) || new Date(),
},
startElement
);
}
}

});

Karthigeyan Krishnamurthi [Syncfusion]
Replied On May 8, 2019 10:32 AM UTC

Hi Vadims 
 
Greetings from Syncfusion. 
 
We suspect that instance is not correct which could be the cause and kindly use the below code example. 
 
changeDate: function(data) { 
      let startDate = this.$refs.starttime.value; 
      startDate = startDate.split(" "); 
      this.$refs.starttime.ej2_instances[0].value = new Date( 
        new Date(startDate[0]).setHours(8) 
      ); 
      this.$refs.endTime.ej2_instances[0].value = new Date( 
        new Date(startDate[0]).setHours(16) 
      ); 
    } 
  } 
 
Regards,  
Karthi  
 


Vadims Talapins
Replied On May 8, 2019 11:44 AM UTC

Hi Karthi,
Thanks a lot everything works as it should.
Syncfusion best!

Karthigeyan Krishnamurthi [Syncfusion]
Replied On May 9, 2019 03:40 AM UTC

Most welcome 😊 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon