Announcement

Do not use the forums to submit bug reports, feature requests or patches, submit a New Ticket instead.

#1 2009-09-04 11:48:14

codepuke
New member
Registered: 2009-09-04
Posts: 2

Strategy for Ajax load of Xinha editor?

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

#2 2009-09-04 16:27:04

ateslik
Xinha Community Member
Registered: 2009-07-16
Posts: 33

Re: Strategy for Ajax load of Xinha editor?

when you close the form are you completely destroying the xinha object?

Offline

#3 2009-09-04 17:04:49

codepuke
New member
Registered: 2009-09-04
Posts: 2

Re: Strategy for Ajax load of Xinha editor?

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

#4 2009-09-08 17:37:48

ateslik
Xinha Community Member
Registered: 2009-07-16
Posts: 33

Re: Strategy for Ajax load of Xinha editor?

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

#5 2009-09-10 12:50:34

cmscritic
New member
Registered: 2009-09-10
Posts: 1
Website

Re: Strategy for Ajax load of Xinha editor?

I have tested this as well and it does indeed work.


Mike Johnston
Senior Editor and Founder
[url=http://www.cmscritic.com]CMS[/url] Critic

Offline

#6 2009-10-02 21:38:29

melayu43
New member
From: malaysia
Registered: 2009-10-02
Posts: 1
Website

Re: Strategy for Ajax load of Xinha editor?

i give it a shoot too

Offline

#7 2009-10-13 09:47:25

hudsonbar
New member
Registered: 2009-10-13
Posts: 2

Re: Strategy for Ajax load of Xinha editor?

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

#8 2011-02-05 18:46:59

sius
New member
Registered: 2011-02-05
Posts: 1

Re: Strategy for Ajax load of Xinha editor?

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

Board footer

Powered by FluxBB