1

I am using django-tinymce in my website. Tinymce editor of the form appear on normal page load, but its tinymce editor doesn't loads when form section is loaded on ajax load(using jquery load). In firebug it doesn't gives any error. What may be the reasons?

Any help would be appreciated.. Thanks

Wentworth
  • 199
  • 2
  • 10

1 Answers1

0

One reason could be that the former tinymce instance has not been shut down correctly. Use this before removing parts of the Dom

tinyMCE.execCommand('mceRemoveControl', false, editor_id);

and reinitialize it afterwards if needed

tinyMCE.execCommand('mceAddControl', false, editor_id);
Thariama
  • 50,002
  • 13
  • 138
  • 166
  • Thanks a lot for the answer.. but for some reasons it didn't worked.. even I tried these commands using firebug console, but it didn't showed any results.. – Wentworth Aug 30 '11 at 12:21
  • you need to call mceRemoveControl when the tinymce editor is still on the page – Thariama Aug 30 '11 at 12:47
  • i didn't get your point exactly.. but tinymce editor is on the page, js is loaded and it alerts if i put tinymce in alert box.. – Wentworth Aug 30 '11 at 13:09
  • ah, ok then. i do not know what is visible on your page when you do the ajax call. could you give some more code (the response of your ajax call), what you do when and what happens in general – Thariama Aug 30 '11 at 13:12
  • The textbox is coming in the form but tinymce editor is not loaded it it, on ajax call response the form section is loaded along with tinymce js is loaded and the tinyMCE.init function is called(The form is not present in actual page initially and is being loaded on ajax call using jquery load). – Wentworth Aug 30 '11 at 13:49
  • do you have one single tinymce instance on your page? if not make sure they have different ids (the textarea id will become the editor id!), tinymce.js can idealy be loaded on the main page (with ajax sound somewhat ugly) – Thariama Aug 30 '11 at 15:00
  • yes I have only single tinymce instance on that page.. ids too are different, yes it may sound ugly but it was needed according to design.. – Wentworth Sep 01 '11 at 05:55
  • that issue was solved finally.. i don't know the exact reason.. but the way it was solved was.. I just moved the tinymce.js out side the ajax section load and put it on the base page where it was loaded(no other changes).. and it worked.. – Wentworth Sep 01 '11 at 14:14
  • glad it works now. that was one reason why i mentioned that tinymce.js should idealy be loaded on the main page – Thariama Sep 01 '11 at 14:58
  • hey Thanks a lot Thariama for all your help and concern.. :) – Wentworth Sep 02 '11 at 08:48