How to change the Edit event URL?

How to change the Edit event URL?

macateemmacateem Posts: 10Questions: 3Answers: 0

I have an application where I can change the context (the Year) of the data. So my URLs will change based on this selection (eg, /properties?year=2018). I know how to update DataTables object, but how can I update the Editor URLs? For example I have defined my edit event:

ajax: {
      edit: {
          type: 'PATCH',
          contentType: 'application/vnd.api+json',
          url: '/properties/_id_/values?taxyear=' + taxYear,
       },

Then when my UI changes the Year, I need to update the edit url. Is there an API for this? I saw that I can get the editor object from editor.on('initEdit', function(e, node, data)
The e object gives me access to a property s which contains the editor object. But I'm not sure I can always refer to that as e.s. Is there an API for getting it from the event e?

Answers

  • allanallan Posts: 63,512Questions: 1Answers: 10,472 Site admin

    I'm afraid no - currently there is no API to modify the URL used for Ajax submission in Editor. Your use of the .s property will work, but it should be noted that it is considered to be an internal property and it could change between versions (albeit it is unlikely that this particular use will stop working!).

    The only other option is to use ajax as a function and make the Ajax call with $.ajax directly.

    Allan

  • macateemmacateem Posts: 10Questions: 3Answers: 0

    Yeah, okay. Thanks for the quick reply. That was one of my thoughts as well. I'm glad to see I wasn't missing something.

This discussion has been closed.