开发者

PropertyGrid in Adobe Flex?

I'm looking for a PropertyGrid-like control for Adobe Flex, or perhaps the easiest way to create one. The main two things it should do in addition to a normal property grid are displaying categories and having different kind of editor controls to edit the data in one column.

So basically I'm looking for a control to edit key/value pairs, divided into categories, with different kinds of editor controls for different keys/rows.

I found exactly what I w开发者_StackOverflow中文版ant right here: http://www.cnblogs.com/janyou/archive/2009/07/28/1532919.html

Though that page is in Chinese, there is no record of source code or where that component came from, etc. I can also not find any other solutions on the web (although maybe my search terms are incorrect, because I'm not entire sure how to search for it).


i've done it using a datagrid with two columns, and this approach works just fine for me:

                <mx:columns>
                    <mx:DataGridColumn dataField="parameter" width="110" resizable="false">
                        <mx:itemRenderer>
                            <mx:Component>
                                <mx:Label truncateToFit="true" fontWeight="bold" />
                            </mx:Component>
                        </mx:itemRenderer>
                    </mx:DataGridColumn>
                    <mx:DataGridColumn dataField="value">
                        <mx:itemRenderer>
                            <mx:Component>
                                <mx:HBox width="100%" height="100%" horizontalScrollPolicy="off" verticalScrollPolicy="off"
                                    currentState="{(data.parameterType) == 'bool' ? 'checkboxState' : 'baseState'}">
                                    <mx:states>
                                        <mx:State name="baseState">
                                            <mx:AddChild>
                                                <mx:Label truncateToFit="true" text="{data.value}" paddingLeft="2" />
                                            </mx:AddChild>
                                        </mx:State>
                                        <mx:State name="chbState">
                                            <mx:AddChild>
                                                <mx:CheckBox selected="{data.value &amp;&amp; parseInt(data.value)}" paddingLeft="5" />
                                            </mx:AddChild>
                                        </mx:State>
                                    </mx:states>
                                </mx:HBox>
                            </mx:Component>
                        </mx:itemRenderer>
                    </mx:DataGridColumn>
                </mx:columns>


Surely this is just a List control with your item renderer instantiating the correct control based on whatever the data is... i.e. if the data is an array, show in a combobox, if it's a number show in a stepper, if its text show in TextInput.

This should be very easy to achieve.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜