PDA

View Full Version : Htmleditor in dialog



jo3bl4k
14 Jul 2007, 2:59 PM
I want insert HtmlEditor in a dialog but i have an error.

The code:


function Prova(dataC){
var creaform;
var dialog;
if(!dialog){
dialog = new Ext.BasicDialog("f-add", {
modal:true,
autoTabs:false,
autoCreate:true,
width:500,
height:300,
shadow:true,
minWidth:300,
minHeight:250,
proxyDrag: true,
title: 'Aggiungi Evento al calendario'
});
dialog.addKeyListener(27, dialog.hide, dialog);
dialog.addButton('Aggiungi', dialog.hide, dialog).disable();
dialog.addButton('Chiudi', dialog.hide, dialog);
dialog.body.setStyle('padding-left:3px');
var top = new Ext.form.Form({
labelAlign: 'top'
});
top.column(
{width:282}, // precise column sizes or percentages or straight CSS
new Ext.form.TextField({
fieldLabel: 'First Name',
name: 'first',
width:225
}),
new Ext.form.TextField({
fieldLabel: 'Company',
name: 'company',
width:225
})
);
top.column(
{width:272, style:'margin-left:10px', clear:true}, // apply custom css, clear:true means it is the last column
new Ext.form.TextField({
fieldLabel: 'Last Name',
name: 'last',
width:225
}),
new Ext.form.TextField({
fieldLabel: 'Email',
name: 'email',
vtype:'email',
width:225
})
);
top.container({},
new Ext.form.HtmlEditor({
id:'bio',
fieldLabel:'Biography',
width:550,
height:200
})
);
top.render(dialog.body);

}

dialog.show();
}

tryanDLS
14 Jul 2007, 6:22 PM
'Have an error' doesn't tell us very much. I tested this with 1.1RC1. The only thing I can see that needs to change is the adding a clear to the editor container. Not sure why the container isn't clearing like it does in the dynamic example.


top.container({style:'clear:both'},
new Ext.form.HtmlEditor({
id:'bio',
fieldLabel:'Biography',
width:550,
height:200
})
);

jo3bl4k
16 Jul 2007, 1:54 PM
Error is: "Previewed object" to line 108. I'm not sure which is the line 108 (in red,
based on dreaweaver), but when i delete the htmlEditor is all ok.
All code:


Ext.QuickTips.init();
var tb = new Ext.Toolbar('toolbar');
tb.add({
text: 'Aggiungi Evento',
enableToggle: true,
tooltip: 'Aggiungi un evmto in data lontana'
});
});
function Prova(dataC){
var top;
var dialog;
if(!dialog){ // lazy initialize the dialog and only create it once
dialog = new Ext.BasicDialog("f-add", {
modal:true,
autoTabs:false,
autoCreate:true,
width:500,
height:300,
shadow:true,
minWidth:300,
minHeight:250,
proxyDrag: true,
title: 'Aggiungi Evento al calendario'
});
dialog.addKeyListener(27, dialog.hide, dialog);
dialog.addButton('Aggiungi', dialog.hide, dialog).disable();
dialog.addButton('Chiudi', dialog.hide, dialog);
dialog.body.setStyle('padding-left:3px');
var top = new Ext.form.Form({
labelAlign: 'top'
});
top.column(
{width:282}, // precise column sizes or percentages or straight CSS
new Ext.form.TextField({
fieldLabel: 'First Name', /* Line 108 */
name: 'first',
width:225
}),
new Ext.form.TextField({
fieldLabel: 'Company',
name: 'company',
width:225
})
);
top.column(
{width:272, style:'margin-left:10px', clear:true},
new Ext.form.TextField({
fieldLabel: 'Last Name',
name: 'last',
width:225
}),
new Ext.form.TextField({
fieldLabel: 'Email',
name: 'email',
vtype:'email',
width:225
})
);
top.container({style:'clear:both'},
new Ext.form.HtmlEditor({
id:'bio',
fieldLabel:'Biography',
width:550,
height:200
})
);
top.render(dialog.body);

}

dialog.show();
}


With clear to the editor there is the same problem.

Jink
27 Jul 2007, 5:19 AM
Try add a "handler: Prova" to the add function when creating the toolbar, that should help.

another issue is that you might check your version of Ext. The older versions does not have HtmlEditor,