PDA

View Full Version : Components inside components... where do i refresh?



mice-pace
2 Oct 2012, 6:29 PM
Just a quick psuedocode example




Container: [Form.Panel]

Form.Panel: [FieldSet1, FieldSet2]

FieldSet1: [Container1, Container2, Container3, Container4]

Container1(hbox): [displayfield, label, displayfield]

(Just focus on Container1 for now, we don't need to know what's in the rest)

Now the two displayfields form a name (first/last) using the label as a spacer. The container they are in has a width, but they do not... the idea being they could expand or shrink to take advantage of the space as they need to.

When I load data into the form.panel the text in each of the displayfields changes, but their width (and therefore their position) doesn't change, leaving them where they are, with either giant gaps or overlapping text

My question then, there are a number of methods to force layout, are there any that bubble down? (if so how far, which components have it etc...) Do I need to refresh each component individually? (perhaps recursively drilling down?) or am I trying to do something EXTJS wasn't meant to do? (I can perhaps replicate the look by having just one displayfield and manipulating the data to make composite data, but that would be messy)

skirtle
3 Oct 2012, 1:13 AM
What you're trying to do sounds fine. Updating the text in a displayfield should automatically re-run the relevant layouts. What ExtJS version are you using?

You can see the code that calls updateLayout here:

http://docs.sencha.com/ext-js/4-1/source/Display.html#Ext-form-field-Display-method-setRawValue

You might want to check whether the version of ExtJS you're using has that line.

mice-pace
3 Oct 2012, 4:24 PM
Nooo... It doesn't have that code. And looking at the URL it's using it's... 4.0.7 Damn.

You've been very helpful Skirtle. Don't suppose you know how to change the EXT JS version on Architect though? :D ...I'll ask elsewhere just in case, but it would be a huge help on the off-chance you did.

skirtle
4 Oct 2012, 1:36 AM
You may need to upgrade your Architect version too.