Button inside a DataGrid... possible?
i created data grid populated external xml file. want first column have button in it. here's tried.
<mx:datagrid>
<mx:columns>
<mx:datagridcolumn>
<mx:button label="click me" />
</mx:datagridcolumn>
</mx:columns>
</mx:datagrid>
error: not resolve <mx:button> component implementation.
is there way create button inside datagrid or have use custom component?
<mx:datagrid>
<mx:columns>
<mx:datagridcolumn>
<mx:button label="click me" />
</mx:datagridcolumn>
</mx:columns>
</mx:datagrid>
error: not resolve <mx:button> component implementation.
is there way create button inside datagrid or have use custom component?
hi,
yes possible include button inside datagrid. have use called itemrenderer. item renderes (and itemeditors) let put (checkboxes, dropdown lists, buttons, images) in datagrid.
there number of ways can create button in datagrid. allways use item renderer, there couple of ways of doing this. i've modified code make work in simplest way posible. button won't anything, code run , see button in datagrid.
<mx:datagrid>
<mx:columns>
<mx:datagridcolumn editable="false"> // i've changd line gyorky
<mx:itemrenderer> // i've added line - gyorky
<mx:component> // i've added line - gyorky
<mx:button label="click me" />
<mx:component/> // i've added line - gyorky
<mx:itemrenderer/> // i've added line - gyorky
</mx:datagridcolumn>
</mx:columns>
</mx:datagrid>
here example program wrote. had button wanted use in number of datagrids, first defined outside datagrid, , added datagrid.
first of all, here button goes in datagrid. have use component tag define it.
<mx:component id="showcontractinsap">
<mx:button label="view contract" enabled="true" click="doclick()">
<mx:script>
<![cdata[
public function doclick():void {
// put want button do. if want call method,
// have prefix outerdocument. e.g. outerdocument.dosomething();
}
]]>
</mx:script>
</mx:button>
</mx:component>
now add datagrid item renderer.
<mx:datagrid x="10" height="190" top="124">
<mx:columns>
<mx:datagridcolumn headertext="view contract"
itemrenderer="{showcontractinsap}" editable="false"/>
</mx:columns>
</mx:datagrid>
it can bit messy , complicated, i'd recommend taking @ documentation on item renderers
let me know if helped
gyorky
yes possible include button inside datagrid. have use called itemrenderer. item renderes (and itemeditors) let put (checkboxes, dropdown lists, buttons, images) in datagrid.
there number of ways can create button in datagrid. allways use item renderer, there couple of ways of doing this. i've modified code make work in simplest way posible. button won't anything, code run , see button in datagrid.
<mx:datagrid>
<mx:columns>
<mx:datagridcolumn editable="false"> // i've changd line gyorky
<mx:itemrenderer> // i've added line - gyorky
<mx:component> // i've added line - gyorky
<mx:button label="click me" />
<mx:component/> // i've added line - gyorky
<mx:itemrenderer/> // i've added line - gyorky
</mx:datagridcolumn>
</mx:columns>
</mx:datagrid>
here example program wrote. had button wanted use in number of datagrids, first defined outside datagrid, , added datagrid.
first of all, here button goes in datagrid. have use component tag define it.
<mx:component id="showcontractinsap">
<mx:button label="view contract" enabled="true" click="doclick()">
<mx:script>
<![cdata[
public function doclick():void {
// put want button do. if want call method,
// have prefix outerdocument. e.g. outerdocument.dosomething();
}
]]>
</mx:script>
</mx:button>
</mx:component>
now add datagrid item renderer.
<mx:datagrid x="10" height="190" top="124">
<mx:columns>
<mx:datagridcolumn headertext="view contract"
itemrenderer="{showcontractinsap}" editable="false"/>
</mx:columns>
</mx:datagrid>
it can bit messy , complicated, i'd recommend taking @ documentation on item renderers
let me know if helped
gyorky
More discussions in Flex (Read Only)
adobe
Comments
Post a Comment