JavaScript UI Libraries & Blazor Components Suite – Smart UI Forums Scheduler How to manipulate an event before it gets saved to the localstorage

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #103420
    Ojo Njoku
    Participant

    Hi guys, please how can i manipulate the data before it gets saved to the localstorage. for example, i want to add a condition before the item gets saved into the localstorage, and inserted to the scheduler. i’ve tried onSubmit method, onItemInsert but the data has already been saved to the localstorage which is not what i want.

    Also how can i remove some fields from the create event modal? i really do not need all the fields and i would love to clean it up.

    Any help, please?

    #103421

    Hi,

    Can you explain what are you trying to achieve?
    You can edit the event object in the itemChanging event.
    This event is triggered when an Event is GOING to be updated/inserted/removed. This event allows to cancel the operation by calling event.preventDefault() in the event handler function.
    event.detail.type contains the type of the operation. You can use this to check if it is ‘inserting’.
    event.detail.item contains the event object that you can manipulate.

     

    Please explain your situation so we can help you!

     

    Please have a look at this demo to see how to hide any datafield in the modal: codepen
    Basically, the event object from the editDialogOpen event contains all the editors in ‘event.detail.editors’.
    From there you can get any editor you want and apply a class ‘smart-hidden’: ‘notificationsEditor.classList.add(‘smart-hidden’);’

    Best Regards,
    Svetoslav Borislavov

    Smart UI Team
    https://www.htmlelements.com/

    #103422
    Ojo Njoku
    Participant

    thanks so much for your reply. the event itemChanging gives me what i want just like you adviced. but then i noticed that when inserting an event, i dont have access to the label value, only when the event is updating, or when i use the onItemInsert event.

    how can i access the label value within the itemChanging event?

    #103423
    Ojo Njoku
    Participant

    am sorry, i mistakenly added a new comment instead of replying to your response

    #103424

    Hi,

    As a workaround, you can declare a variable which will store the input element of the label.
    In the handler of the editDialogOpen event, you will initialize the variable with the reference of the label input element and in the ItemChanging event you can access the value of the input element. This can be done for any element.

    Here is an example: https://codepen.io/svetoslavb04/pen/rNdwxOd

     

    If you need any help, do not hesitate to contact us!

    Best Regards,
    Svetoslav Borislavov

    Smart UI Team
    https://www.htmlelements.com/

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.