Is it possible to change the ajaxUrl for an existing editor

Is it possible to change the ajaxUrl for an existing editor

paulhickmanpaulhickman Posts: 21Questions: 1Answers: 0
edited February 2013 in Editor
Is there an official API method to dynamically change the ajaxUrl setting of an existing editor object?

From the object inspector in chrome, It looks like I could write:

[code]
myEditor.s.ajaxUrl.create = 'newurl'
[/code]

and it will work, but I suspect that is not a method that would be supported for future version compatibility.

Replies

  • allanallan Posts: 61,723Questions: 1Answers: 10,108 Site admin
    Correct on all accounts. There isn't a public API for this at the moment, but that is the workaround for how you would set the internal value. It is unlikely that interface will change in the near future (there aren't any plans to change it), but it is possible that it could.

    What is the use case? If this is likely to be a common then perhaps this should be added. The other option is for the `ajax` option to allow function assignment as well as strings / objects as it does at the moment, so the function would be run when Editor needs the URL, allowing it to be computed externally.

    Allan
  • paulhickmanpaulhickman Posts: 21Questions: 1Answers: 0
    I'm writing an HTML app so it is one html file and all further communication is ajax. There are various entities that require translations, so I have created a jquery ui dialog with a data table in it that lists the languages and the term translated into those languages, with an editor attached for adding more translations. Given it is different entity classes I am translating, when I popup the dialog I want to re-route the datatable and editor to the web services for the controller of the entity type in question.

    However, the dialog is not removed from the DOM when it is closed so the 2nd time I open it, I'm modiyfing any existing table and editor.
  • allanallan Posts: 61,723Questions: 1Answers: 10,108 Site admin
    I see - thanks for the explanation. I think for the moment the best way will be to manipulate the settings object in Editor while I think of the best way to present a public API to update configuration settings such as this. Likely the first change in that direction will be to allow `ajax` to be given as a function.

    Like DataTables, generally speaking, Editor settings should not be changed, as that change wouldn't be reflected without somehow telling Editor that something has changed.

    Generally, I would recommend simply creating a new Editor instance for each form with a different Ajax url, but I can see that it would be useful to be able to modify the value on-the-fly.

    Regards,
    Allan
This discussion has been closed.