You are not logged in.
Hi All;
I load a form via an ajax call. The form has a xinha editor in it. Within the form I call the xinha init function. The form loads fine on the first request and I can use the editor. However, if I close the form and then reload it the resultant xinha editor that gets loaded looks slightly broken and can't be clicked on or used.
Is there a strategy out there for using Xinha in this manner?
Thank you kindly
Offline
when you close the form are you completely destroying the xinha object?
Offline
Hi, well the form is removed from the DOM.
Is there some sort of dispose method I should be calling? I couldn't find any such method on the wiki, or via a google search.
Offline
xinha_editors = null;
xinha_init = null;
xinha_config = null;
xinha_plugins = null;
at the head of your javascript for loading the xinhas. Clears out all the vars before resetting them AFAIK.
Offline
there are 2 ways,
the raw way, and the library way.
the raw way... you make all these calls on javascript routines. Very Long.
the library way: simple calls to routines that do all the dirt for you!
$.get initiates an asynchronous http request and does all the multi-tasking for you, so you don't sit around waiting for results.
I use jquery (http://jquery.com) and I have also done it the old-fashioned raw way!
Regards
Rimpy
Offline
The following Ajax response works (it uses jQuery to select the textarea element):
<textarea>Content to edit</textarea>
<script type="text/javascript">
xinha_config = null;
xinha_plugins = null;
xinha_editors = [$('textarea')[0].id];
xinha_init();
</script>
in this scenario the last line in the xinha/config.js is not required:
// Xinha._addEvent(window,'load', xinha_init);
Last edited by sius (2011-02-05 18:48:25)
Offline