View Full Version : Messy Layouts
dimitrij.zub
11 Jul 2008, 1:44 AM
Hi everyone.
I have kind of a complex layout which is randomly rendered as a mess. So the fields move, are too big and so on. And as well randomly the field looks just perfect!
Does anybody have any idea what the problem might be?
Animal
11 Jul 2008, 1:48 AM
Sorry, my crystal ball is at home right now.
In the absence of that, and in the same vein as your posting, I'd say the answer is: You've done something wrong.
dimitrij.zub
11 Jul 2008, 1:55 AM
OK so no obvious reason :)
Lets see:
I am adding a custom panel to a tab pane.
Upon this adding it gets layouted kinda messy.
I am attaching the files below which are doing the jobs.
See the messy1, messy2 and fine.jpgs
I have the feeling that i am doing something wrong in the design of how the components should work, as I am not a JavaScript extpert.
Some help on making the beheviour of ExtJS deterministic would be highly appriciated.
Animal
11 Jul 2008, 2:14 AM
It looks OK at first glance.
One thing I noticed:
_tab_panel.insert(0, _panel).show();
You don't get to show the items in a multi-child Container. You ask the Container to show the one you want. Use setActiveItem. And configure your TabPanel with layoutOnTabChange:true
dimitrij.zub
11 Jul 2008, 2:28 AM
Done that. Still the problem persists.
The funny thing is, that it DOES render the tab sometimes just perfect. But if I close it and open it again, is MIGHT be messed up.
As well I have a lot of strange behavior going on in my project like some elements are not shown if i remove some lines of text and so on.
But back to the basic problem and maybe some best practice. ...
I am building the portal in panel objects all should behave independent what shall I do to have the most independend structure with JS/ExtJS?
I have the feeling that it just sucks at a lot of spaces and depends on a lot of factors how the whole thing is behaving and its slipping out of controll some how :(
I did the blog 'Writing big application with Ext' and followed the guidlines but still i feel like im running into some mess the bigger the project will get :(
Animal
11 Jul 2008, 2:32 AM
"Close it and open it."?
Does it get destroyed, and recreated?
It would be easier to see what was going on if you could post a link to a live page.
dimitrij.zub
11 Jul 2008, 3:02 AM
I cant provide a live page now as I have no access to the router here :(
Close it means:
I close it on the panel (Click on the x)
Open it means: It gets recreated. (See Actions...)
Funny thing i just discovered:
If i add another panel with fields and then add the EditAccountPanel the chance to have a messed up layout is much higher. (See Actions -> password_panel)
Animal
11 Jul 2008, 3:15 AM
You are hardcoding an ID into a class definition. Classes are reusable, but IDs must be unique:
Ext.rt.EditAccountPanel = Ext.extend(Ext.form.FormPanel, {
id: 'Ext.rt.EditAccountPanel', <-- bad
dimitrij.zub
11 Jul 2008, 4:15 AM
I did this i.o. to find the class later in the management (s. Actions) -> tab.activate.
You have an idea of how to manage this otherwise?
dimitrij.zub
11 Jul 2008, 4:34 AM
Tried removing ids from everywhere. Still random layout problems. :-?
Animal
11 Jul 2008, 4:43 AM
I did this i.o. to find the class later in the management (s. Actions) -> tab.activate.
You have an idea of how to manage this otherwise?
?
dimitrij.zub
11 Jul 2008, 4:44 AM
More information on the problem:
The messy layouts are normaly due to random fields of the form being set too big. Again completely random.
dimitrij.zub
11 Jul 2008, 4:45 AM
?
I also need ids i.o. to make IE work at all :( If there are no ids in the forms or whatsoever IE completely ****s up everything in a layout.
Man this is starting to get damn annoying with ExtJS.
Animal
11 Jul 2008, 4:47 AM
You must have some weird code to get all that.
IDs are generated uniquely for all Components. You don't have to specify one.
dimitrij.zub
11 Jul 2008, 5:05 AM
Thats exactly what im thinking. There is a lot of onReady function ****.
I have added now Math.random explecitely to all components im am using and the problem is gone..
So that brings me to another problem:
How to 'merge' all the 6 files that i have in an intelligent way? I mean:
Menu.js -> Building the menu
Page.js -> Building the page etc..
All have an onready function. Might this be the mess?
Animal
11 Jul 2008, 5:40 AM
It's not necessary. It's only needed in the main application. These files don't all just go off and do stuff do they? They contain classes which are used by the application, so surely there's nothing to put onReady around?
dimitrij.zub
11 Jul 2008, 6:05 AM
Well..
The problem is that the menu is part of a template and therefor all the other files dont know about it.
So the menu definitly needs a onReady to render itself. For all the other pages ure right. I have the strong feeling that more then one onReady is really not good.
Can you help me understand how ExtJS is creating the view by pointing to some architecture description of the framework?
Animal
11 Jul 2008, 6:05 AM
What the menu is static HTML?
Animal
11 Jul 2008, 6:06 AM
There's no huge mystery. Ext just creates DIVs.
dimitrij.zub
11 Jul 2008, 6:16 AM
Menu: attached.
Animal
11 Jul 2008, 6:25 AM
DO NOT EVER RENDER!
Use a Viewport to encapsulate the whole document body in a Container, and from then on, just add Components to Containers
No wonder the layout gets messy if you render.
Powered by vBulletin® Version 4.1.5 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.