so I remove verticalScrollPolicy and I get a scroll bar. I add
verticalScrollPolicy and I only see the first 6 rows.
What?!
How do I do the obvious: How to I make it so the list shows all 9 rows? Do I
have to build my own custom control to do this really simple task? I really
hope not - if you can't tell this is ridiculously frustrating.
<mx:Application
xmlns:mx="http://www.adobe.com/2006/mxml"
layout="absolute"
backgroundColor="#FFFFFF"
xmlns:local="*"
initialize="init()">
<mx:List id="dg"
width="100%"
verticalScrollPolicy="off">
</mx:List >
<mx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
private function init():void {
var a:ArrayCollection = new ArrayCollection();
a.addItem("1");
a.addItem("2");
a.addItem("3");
a.addItem("4");
a.addItem("5");
a.addItem("6");
a.addItem("7");
a.addItem("8");
a.addItem("9");
this.dg.dataProvider = a;
}
]]>
</mx:Script>
</mx:Application>
http://cadenwhitaker.t35.com/mxlist/
notice how the List isn't scaling properly in the blue squares (because they
are rendered after the fact)?
Please, someone give me a good solution to this! I can't believe that Flex
runs everything off on their own threads and then expects me to somehow gather
who the last firing object was just so I can tell all the lists to update their
row heights... GAHHH!
Override the measure() function.
This is a good primer on what you need to know to write itemRenderers well
http://www.adobe.com/devnet/flex/articles/itemrenderers_pt1.html
http://www.quietlyscheming.com/blog/components/randomwalk-component/ was
written as a tutorial of how to build components from scratch with best
practice.
HTH;
Amy
Where? Which component? Override it to do what?
Thanks for the link but I could really really really use a direct answer to
this specific issue. Not an overview on proper procedures. Unless following
proper procedures will somehow make this work, I'll still need to override
(hack) this to work as you have described.
If you go through the proper procedures in the links I posted, they will
show you how and where to override measure().
You realize there are hundreds of lines of code and several xaml files? I'm
just looking for a reduced example of my specific issue. Not a manual, not a
best practices. You know what? Fine. I'll dig through these, I guess I have
nothing to do for the next few hours.
This is a bug. This is a ridiculously stupid bug and I can't believe that we
are in version 3 and I have to resort to hours reading long winded documents
just to find a cryptic message on how to override a measurement because I want
to get a %@#! list to work like it is supposed to.
You could also do a search in the help for measure()...
Can someone from Adobe explain why they decided to leave this simple ability
out of Flex? Or could they post code exactly how to do this simple procedure?
I'm tired of debugging, I'm tired of "hacking" to get this working, I'm tired
of the #%@! measure function. I feel like this is so simple (a list) that there
should be a document online outlining exactly how to do this. Not some
super-detailed example of something I don't need. Something that just covers
this, that's it, that's all.
So, could someone explain to me what the deal is?
Example
http://cadenwhitaker.t35.com/mxlist/
Unfortunately, you DO need to understand the entire component lifecycle to
understand why your code isn't working. So you're going to need to just dig
in and apply whatever time it takes until you _do_ understand it. It's not
going to go away because you don't want to look at it.
<?xml version="1.0" encoding="utf-8"?>
<mx:Application
xmlns:mx="http://www.adobe.com/2006/mxml"
xmlns:local="*"
layout="vertical" horizontalAlign="center"
backgroundColor="#FFFFFF"
applicationComplete="init()">
<mx:List id="dg"
width="200"
dataProvider="{a}"
rowCount="{a.length}"
verticalScrollPolicy="off" />
<mx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
[Bindable] public var a:ArrayCollection;
private function init():void {
a = new ArrayCollection();
a.addItem("1");
a.addItem("2");
a.addItem("3");
a.addItem("4");
a.addItem("5");
a.addItem("6");
a.addItem("7");
a.addItem("8");
a.addItem("9");
a.addItem("10");
}
]]>
</mx:Script>
</mx:Application>
See, I have this link
http://cadenwhitaker.t35.com/mxlist/
And I want to see someone reference a fix using that example. Or I want to see
an answer using an example as basic as my own. I want to see someone talk about
this specific issue - not a reference to an entire application and not a
reference to the poorly written livedocs.
I also want to know why this issue is here, why do I have to make hacks in
order to get my example (http://cadenwhitaker.t35.com/mxlist/) to work.
Did my solution not work for you?
<mx:List id="dg"
width="200"
dataProvider="{a}"
[b]rowCount="{a.length}"[/b]
verticalScrollPolicy="off" />
Also, OP should have just a little more patience, sometimes the answer doesn't
come instantly on forums! =)
Thanks fir that actually no I didn't overlook it, that first issue was a minor
issue and yeah I implemented something similar (however, thank you for a simple
direct reply!). The real issue can be found at the url I posted several times
(which Ansury must have overlooked!)
http://cadenwhitaker.t35.com/mxlist/
The issue is, of course, that your problem cannot be solved with a simple,
direct reply unless someone is willing to go through your code and write the
solution for you. For you to solve the problem yourself, you will need to
put your thinking cap on and process the information you've been pointed to.
If you are not willing to do that, your options are:
(1) Give up
(2) Post to the FlexJobs Yahoo group and try to find a consultant to do it.
(3) Hope someone here will donate enough time to rewrite your code for you.
Amy, fine, I guess I should have just gone with your suggestion in the first
place. Who am I to come back and say "That isn't enough information" or "That
isn't helping me" or "Can I have more information"... I should just take what
has been given to me. Nothing good ever comes from asking people to try and be
more clear.
I gave you a direct and simple solution to the problem that you posted. This
is most often the case if you read the forum regularly. Answers are to help
one help themselves; a common function of "user-to-user discussions" as this
forum is. Remember. Responses are the "good will" of individuals not unlike
yourself: learning, trying different things and sharing result with others.
I think that you got off on the wrong foot here and should reconsider the
attitude that you want to portray in your posts. IMHO
Just a suggestion though.
I don't have a better way to articulate what those links I sent you to said
than the people who said it. If there was a specific concept you were
having problems with, I would be happy to answer that.
Hope this clarifies;
Amy
The problem is that his issue is not as simple as your answer. His problem
is caused by the fact that List Based components typically just populate one
itemRenderer with data, measure with that, and lay out all of the components
from it.
I haven't looked at the part of the DataGrid code that deals with
variableRowHeight, but I am pretty sure that it will adjust the size of the
row based on the tallest itemRenderer, as long as the component is reporting
its size correctly at the time that this is measured. What often happens
with custom itemRenderers is that something happens in the renderering
process that affects its overall size, but it will happen at an
inappropriate time and the developer doesn't realize what order the events
are happening. So you really have to understand the component life cycle in
order to fix these types of problems.
I have code out there with lingering problems of this type I just didn't
know how to fix when I wrote it, and I couldn't say for certain if I could
fix it now if I were to go back and revisit it. It's just part of life as a
Flex developer.
HTH;
Amy