PDA

View Full Version : htmleditor not rendering value in 3.0



paulSC
29 Jun 2009, 5:41 AM
I have added some existing code from a 2.2 app to 3.0. In the 3.0 application I am able to do a console.info to view the editor value and I'm also able to do a getValue() on the component in firebug to retrieve the value. The value doesn't render in the editor and doesn't exist in the generated html for the page. The 2.2 version which is exactly the same code works perfectly, are there any current issues or bugs with the html editor in 3.0?



{
xtype:'panel',
layout:'border',
items:[{
xtype: 'htmleditor',
region:'center',
id:'court-document-editor-'+court_document.id,
value: court_document.markup,
fieldLabel:'Markup',
name: 'court_document[markup]',
readOnly: false,
editable: true,
enableAlignments: false,
enableColors: false,
enableFont: false,
enableFontSize: false,
enableFormat: true,
enableLinks: false,
enableLists: false,
enableSourceEdit: false,
width:'80%',
anchor:'100%'
}]
}

30 Jun 2009, 5:37 AM
why are you using aborder layout with a region? just use fit.

paulSC
30 Jun 2009, 5:50 AM
There's also a south and east region which I didn't post the code for.

Condor
30 Jun 2009, 6:21 AM
Why does the editor have a 'fieldLabel', 'anchor' and an (invalid) 'width' when it is a center region of a border layout?

I can't see anything wrong with the value of the HTML editor...

I did however notice a bug in the positioning of a HTML editor in a border layout (see bugreport (http://extjs.com/forum/showthread.php?t=72869)).

Temporary workaround: Create an extra region:'center' panel with layout:'fit' that holds the HTML editor.

paulSC
30 Jun 2009, 7:14 AM
I did the following, assuming I did it correctly the htmleditor object has the value but still won't render it to the body of the editor. I confirmed the value in firebug console. The other thing I should probably add, if it makes a difference, is the editor is part of a row expander template for a grid. Thanks again for the help.




{
xtype:'panel',
layout:'border',
height:400,
items:[{
xtype:'panel',
region:'center',
layout:'fit',
items:[{
xtype: 'htmleditor',
id:'court-document-editor-'+court_document.id,
value: court_document.markup,
name: 'court_document[markup]',
readOnly: false,
editable: true,
enableAlignments: false,
enableColors: false,
enableFont: false,
enableFontSize: false,
enableFormat: true,
enableLinks: false,
enableLists: false,
enableSourceEdit: false
}]
}

Condor
30 Jun 2009, 7:18 AM
Putting components is a rowexpander is dangerous.

If the row is edited the expander is recreated, but the original components aren't destroyed (unless you add code to do this manually).
This is not only a memory leak, but it also breaks the components that are recreated, because they use already existing ids.

paulSC
30 Jun 2009, 7:30 AM
The only editing that's done is through the expander template, we don't allow editing of the rows directly. I'm not sure if that's what you mean. We do reload the Json store used for the grid after updates, would this yield the same potential memory leaks and object issues?

Condor
30 Jun 2009, 7:44 AM
Yes, all store update and delete (including load) actions will force a recreate of the expander(s).

You can probably modify your expander code to avoid this problem (you need to log the components you created for an expander, and before an expander is updated/deleted destroy the components you logged for that expander).

paulSC
30 Jun 2009, 9:14 AM
Yes, all store update and delete (including load) actions will force a recreate of the expander(s).

You can probably modify your expander code to avoid this problem (you need to log the components you created for an expander, and before an expander is updated/deleted destroy the components you logged for that expander).

Are there any existing tutorials are example code that will show the proper way to do this? We use expanders to edit in a lot of grids, and while they all don't contain html editors most of them contain other objects like combo boxes. So it's something we should probably do throughout our system. Thanks again.