flex - Extending DataGrid component, and adding buttons to it -


i'd extend standard datagrid component in flex mxml. want add buttons bottom of component. i've tried attempting following not working...

am adding button wrong element?

<mx:datagrid xmlns:fx = "http://ns.adobe.com/mxml/2009"              xmlns:mx = "library://ns.adobe.com/flex/mx"              xmlns:s = "library://ns.adobe.com/flex/spark">      <fx:script>         <![cdata[             override protected function createchildren():void             {                 super.createchildren();                  listcontent.addchild(button);             }         ]]>     </fx:script>      <s:button id="button" label = "asdasdas"/> </mx:datagrid> 

you need define "not working"! getting compiler errors? or runtime errors? or button not showing up? i'll assume latter.

the datagrid not have mechanism positioning or laying out it's children. button has height , width of 0 , resides @ position 0,0; making invisible. many flex container classes have ability size , position children; datagrid not container , not provide built in functionality that. focuses, primarily, on working columns array.

you need override updatedisplaylist() position function. quite possibly need make changes commitproperties() , measure() along way. may need re-work how columns positioned , sized not interfere new button. if stuff locked away in private methods (which probable) you're in not-so-fun-time.

read on flex component lifecycle methods more information , review datagrid code figure out does.

you may have easier time putting button , datagrid in container, , treating container single entity instead of trying button renderered inside of datagrid.


Comments

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -