PDA

View Full Version : TextField coordinate



ssaresin
24 Aug 2009, 9:35 AM
Hello,

I want position a textfield inside a formpanel where I want, using x and y coordinates.
In the api documentation there is this:
x (http://extjs.com/forum/../deploy/dev/docs/source/BoxComponent.html#cfg-Ext.BoxComponent-x) : NumberThe local x (left) coordinate for this component if contained within a positioning container.

I cannot understand how to use this config option.
Anybody can help me, or have an example ?

Thanks
Simon

a piece of my code

var FormGER10V = new Ext.form.FormPanel({
standardSubmit: true,
renderTo:document.body,
labelWidth:80,
autoscroll: true,
layout: 'form',
frame:true,
title:'TEST DFM -----SARESIW01',
defaultType:'textfield',
monitorValid:true,

items:[
new Ext.form.FieldSet({
title: 'GER10V',
defaultType: 'textfield',
items: [
new Ext.form.TextField({
id:'WCOD',
width:60,
x:100,
y:180,
value:'99999',
fieldLabel:'WCOD',
name:'WCOD',
maxLength:5,
maxLengthText: 'Inseriti troppi caratteri. Max=5'
}),
new Ext.form.TextField({
id:'WOPZ',
width:30,
x:100,
y:450,
value:'11',
fieldLabel:'WOPZ',
name:'WOPZ',
maxLength:2,
maxLengthText: 'Inseriti troppi caratteri. Max=2'
}),
new Ext.form.TextField({
id:'WRAGS',
width:260,
x:150,
y:180,
value:'1111111111111111111111111',
fieldLabel:'WRAGS',
name:'WRAGS',
maxLength:25,
maxLengthText: 'Inseriti troppi caratteri. Max=25'
}),
new Ext.form.TextField({
id:'WFIS',
width:170,
x:200,
y:180,
value:'',
fieldLabel:'WFIS',
name:'WFIS',
maxLength:16,
maxLengthText: 'Inseriti troppi caratteri. Max=16'
})
})],
})

]

Animal
24 Aug 2009, 9:41 AM
It's generally not good to position things absolutely.

What are yoiu trying to achieve? Do you have a screenshot?

ssaresin
24 Aug 2009, 10:21 AM
I am agree with you.
But in this case I'm making a study about modernization.
I will try to explain:
I have programs that manage a lot of fields in the same screen.
I made a connection between the old server and the browser.
I can get the fileds and write/update them from the browser.

I know where position the fields but I cannot do it.
Now I can only emit a screen like this:

Animal
24 Aug 2009, 1:31 PM
And how would you like it to look?

This is what Ext's rich layout system is FOR!

ssaresin
24 Aug 2009, 11:25 PM
Well, If I can put the fields and its labels where I want, the form should look similar to this sample:

Animal
24 Aug 2009, 11:40 PM
Look at your example/form/dynamic.js example for how to use layouts inside forms.

Looks like you need embedded table or hbox Containers in that FormPanel to lay out across it:



{
xtype: 'container',
layout: {
type: 'hbox'
},
defaults: {
xtype: 'container',
layout: 'form',
flex: 1,
padding: 5
},
items: [{
items: {
xtype: 'textfield',
fieldLabel: 'Col 1 textfield',
anchor: '100%'
}
}, {
items: {
xtype: 'textfield',
fieldLabel: 'Col 2 textfield',
anchor: '100%'
}
}]
}

ssaresin
25 Aug 2009, 7:43 AM
OK, I will follow this solution. I will inform you about the result.
Many Thanks for now.

Simon