PDA

View Full Version : Problem with comboBox and JsonReader



chuvinha
29 Dec 2010, 9:07 AM
Hi guys, I am with little problem with my comboBox.
It appears the button to click of right side from field.
I would that it appear on the left from field.




var fieldTipoArquivoStore = new Ext.data.Store({
proxy: new Ext.data.HttpProxy({url: 'resulttipodearquivo.action'}),
reader: new Ext.data.JsonReader({
root: 'linhas',
fields: [
{name: 'idTipoArquivo'},
{name: 'tipoArquivo'}
]
}),
autoLoad: true
});

var fieldTipoArquivo = new Ext.form.ComboBox( {
fieldLabel : 'Tipo Arquivo',
anchor : '100%',
store: fieldTipoArquivoStore,
displayField:'tipoArquivo',
valueField: 'idTipoArquivo',
editable: false,
forceSelection: true,
triggerAction: 'all',
allowBlank:false,
width: 278,
autoHeight: true,
blankText: "campo obrigatório"
});


Could someone help me?

29 Dec 2010, 10:36 AM
that's the way the combo box is configured and is a common UI practice! If you want to deviate from the standard, you're going to have to extend Ext.form.ComboBox and change the way the HTML is configured as well as change some of the CSS styles.

chuvinha
29 Dec 2010, 11:27 AM
Do you have some example friend?

chuvinha
29 Dec 2010, 11:55 AM
Sorry, I spoke wrong.
In true the comboBox's button is of left side from comboBox.
That's why I thought weird.
I want that it stays of right side.
What did I do wrong in the code?

29 Dec 2010, 12:07 PM
remove autoHeight: true,
set width OR anchor, not both.

chuvinha
30 Dec 2010, 2:47 AM
I removed the autoHeight.
So I put just the width and It wasn't work.
I put just the anchor and the o field disappeared and only kept the button =//

Condor
30 Dec 2010, 3:37 AM
You'll have to post the code for the containers of the combobox. I assume you've misconfigured the layout somewhere.

chuvinha
30 Dec 2010, 3:42 AM
Then Condor, I also have the formPanel.




var form = new Ext.form.FormPanel( {
id : 'arquivoForm',
renderTo : 'formUpload',
fileUpload : true,
monitorValid : true,
items : [ fieldCodigo, fieldTipoArquivo],
buttons : [ btnCancelar, btnSalvar ]
});

Condor
30 Dec 2010, 3:50 AM
That formpanel isn't sized in any way. I recommend using the FitToParent plugin for this.

chuvinha
30 Dec 2010, 4:18 AM
I still have the window:




PopupDialog = Ext.extend(Ext.Window, {
id : 'popupProdutoArquivos',
layout : 'form',
height : 'auto',
width : 400,
closable : false,
draggable : true,
resizable : true,
modal : true,
shadow :true
});



Would you have some example about FitToParent?

Condor
30 Dec 2010, 4:31 AM
So you have a window with a form. Why isn't the form an item of the window?

chuvinha
30 Dec 2010, 4:47 AM
Because the window is in other jsp =//

Condor
30 Dec 2010, 4:52 AM
And? That doesn't stop you from adding the form to the window instead of rendering it to the window.

chuvinha
30 Dec 2010, 4:56 AM
I didn't understand.
How would I do that?

Condor
30 Dec 2010, 6:06 AM
Instead of:

renderTo : 'formUpload'
you use:

var win = Ext.getCmp('popupProdutoArquivos');
win.add(form);
win.doLayout();
(or something like that - I'm not sure, because you didn't post all your code)