Would you like to react to this message? Create an account in a few clicks or log in to continue.


Pakistan is contributing at its best in the field of latest technologies, platforms and approaches. Here,Flex developers share their experience, knowledge and ideas to assure their best talent in the world.

Latest topics
» Advice sought on recruiting a Senior Flex developer in Lahore
ItemRendering issues EmptyTue May 11, 2010 2:41 pm by anjum

» steam boiler efficency calculator
ItemRendering issues EmptyWed Dec 23, 2009 4:55 am by imranmalik

» URLLoader and URLRequest application
ItemRendering issues EmptyTue Dec 15, 2009 6:01 pm by imranmalik

» Time display by ILOG ELIXIER PACKAGE
ItemRendering issues EmptyThu Dec 10, 2009 9:28 am by imranmalik

» how Filter XML data by Flash Builder
ItemRendering issues EmptySat Dec 05, 2009 6:33 pm by imranmalik

» drag and drop (Advance Data Grid to List Box)
ItemRendering issues EmptyThu Nov 19, 2009 7:12 pm by imranmalik

» access the xml file through HTTPService request
ItemRendering issues EmptySun Nov 15, 2009 11:46 am by imranmalik

» CURRENCY VALIDATOR
ItemRendering issues EmptyTue Nov 03, 2009 2:06 pm by imranmalik

» Synchronous Behavior
ItemRendering issues EmptySun Nov 01, 2009 8:04 pm by imranmalik

Social bookmarking
Social bookmarking reddit      

Bookmark and share the address of on your social bookmarking website


You are not connected. Please login or register

ItemRendering issues

2 posters

Go down  Message [Page 1 of 1]

1ItemRendering issues Empty ItemRendering issues Wed Oct 28, 2009 2:23 pm

nasir

nasir

I face problem when i try to renderer the Radio buttons on FlexGrid,their behaviour is immature that when i click a related radio then other radio show response,which is not concerning to my routine.I use Repeater to handle this issue but still want a good solution in FlexGrid.

2ItemRendering issues Empty Re: ItemRendering issues Wed Oct 28, 2009 2:33 pm

anjum

anjum

Please visit this link,may solve your problem

http://www.adobe.com/devnet/flex/articles/itemrenderers_pt1.html

regards,
anjum

https://flexpakistan.board-directory.net/

3ItemRendering issues Empty Re: ItemRendering issues Wed Oct 28, 2009 2:37 pm

anjum

anjum

To understand itemRenderers, you have to understand why they are what they are and what our intentions were when we designed them. By the way, when I say "we," I really mean the Adobe Flex engineering team. I had nothing to do with it. Anyway, suppose you have 1,000 records you want to show. If you think the list control creates 1,000 itemRenderers, you are incorrect. If the list is showing only 10 rows, the list creates about 12 itemRenderers—enough to show every visible row, plus a couple for buffering and performance reasons. The list initially shows rows 1–10. When the user scrolls the list, it may now be showing rows 3–12. But those same 12 itemRenderers are still there: no new itemRenderers are created, even after the list scrolls.

Here's what Flex does. When the list is scrolled, those itemRenderers that will still be showing the same data (rows 3–10) are moved upward. Aside from being in a new location, they haven't changed. The itemRenderers that were showing the data for rows 1 and 2 are now moved below the itemRenderer for row 10. Then those itemRenderers are given the data for rows 11 and 12. In other words, unless you resize the list, those same itemRenderers are reused—recycled—to a new location and are now showing new data.

<mx:DataGrid x="29" y="303" width="694" height="190" dataProvider="{testData.book}" variableRowHeight="true">
<mx:columns>
<mx:DataGridColumn headerText="Pub Date" dataField="date" width="85" />
<mx:DataGridColumn headerText="Author" dataField="author" width="125"/>
<mx:DataGridColumn headerText="Title" dataField="title">
<mx:itemRenderer>
<mx:Component>
<mx:HBox paddingLeft="2">
<mx:Script>
<![CDATA[
override public function set data( value:Object ) : void {
super.data = value;
var today:Number = (new Date()).time;
var pubDate:Number = Date.parse(data.date);
if( pubDate > today ) setStyle("backgroundColor",0xff99ff);
else setStyle("backgroundColor",0xffffff);
}
]]>
</mx:Script>
<mx:Image source="{data.image}" width="50" height="50" scaleContent="true" />
<mx:Text width="100%" text="{data.title}" />
</mx:HBox>
</mx:Component>
</mx:itemRenderer>
</mx:DataGridColumn>
</mx:columns>
</mx:DataGrid>
Note:
The outerDocument identifier changes the scope to look into the file, or outer document, with reference to the <mx:Component>. Now beware: the function has to be a public function, not a protected or private one. Remember that <mx:Component> is treated as an externally defined class.

https://flexpakistan.board-directory.net/

4ItemRendering issues Empty Re: ItemRendering issues Wed Oct 28, 2009 4:09 pm

nasir

nasir

Anjum bhai thanks for your nice effort,but i add radiobutton in Grid and wash extra coloumn because of only focus on problem which is multiple selection of radio.Iwant to block it.


<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="init()">
<mx:RadioButtonGroup id="rg"/>
<mx:DataGrid x="10" y="10" width="694" height="75" dataProvider="{book}" variableRowHeight="true" id="dg">
<mx:columns>
<mx:DataGridColumn headerText="Title" dataField="title">
<mx:itemRenderer>
<mx:Component>
<mx:HBox paddingLeft="2">
<mx:Script>
<![CDATA[
import mx.controls.Alert;
override public function set data( value:Object ) : void
{
super.data = value;
rdo.selected = data.selectedInd;
}
private function show(e:Event):void
{
data.selectedInd=rdo.selected;
Alert.show("" + data.title);
}
]]>
</mx:Script>
<mx:RadioButton click="show(event)" group="{outerDocument.rg}" id="rdo"/>
<mx:Text width="100%" text="{data.title}" />
</mx:HBox>
</mx:Component>
</mx:itemRenderer>
</mx:DataGridColumn>
</mx:columns>
</mx:DataGrid>
<mx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
[Bindable]
private var book:ArrayCollection = new ArrayCollection();
private function init():void
{
for(var x:int = 0; x < 10; x++)
{
var obj:Object = new Object();
obj.title = "Title "+x;
obj.selectedInd = false;
book.addItem(obj);
}
}
]]>
</mx:Script>
</mx:Application>

5ItemRendering issues Empty Re: ItemRendering issues Wed Oct 28, 2009 4:27 pm

anjum

anjum

please update ur code with this code snippet,hofefully it will resolve ur problem.
private function resetOtherBRadioButtons():void
{
for(var x:int = 0; x < book.length; x++)
{
book.getItemAt(x)["selectedInd"] = false;
}
}
//--------------------------------------------
private function show(e:Event):void
{
resetOtherBRadioButtons();
data.selectedInd=rdo.selected;
Alert.show("" + data.title);
}

https://flexpakistan.board-directory.net/

6ItemRendering issues Empty Re: ItemRendering issues Thu Oct 29, 2009 10:02 am

nasir

nasir

thank u anjum bhai.this code is working properly and hit the related radio,no multiple selection now.'Very Happy'


<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="init()">
<mx:RadioButtonGroup id="rg"/>
<mx:DataGrid x="10" y="10" width="694" height="75" dataProvider="{book}" variableRowHeight="true" id="dg">
<mx:columns>
<mx:DataGridColumn headerText="Title" dataField="title">
<mx:itemRenderer>
<mx:Component>
<mx:HBox paddingLeft="2">
<mx:Script>
<![CDATA[
import mx.controls.Alert;
override public function set data( value:Object ) : void
{
super.data = value;
rdo.selected = data.selectedInd;
}
private function show(e:Event):void
{
resetOtherBRadioButtons();
data.selectedInd=rdo.selected;
Alert.show("" + data.title);
}
private function resetOtherBRadioButtons():void
{
for(var x:int = 0; x < outerDocument.book.length; x++)
{
outerDocument.book.getItemAt(x)["selectedInd"] = false;
}
}
]]>
</mx:Script>
<mx:RadioButton click="show(event)" group="{outerDocument.rg}" id="rdo"/>
<mx:Text width="100%" text="{data.title}" />
</mx:HBox>
</mx:Component>
</mx:itemRenderer>
</mx:DataGridColumn>
</mx:columns>
</mx:DataGrid>
<mx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
[Bindable]
public var book:ArrayCollection = new ArrayCollection();
private function init():void
{
for(var x:int = 0; x < 10; x++)
{
var obj:Object = new Object();
obj.title = "Title "+x;
obj.selectedInd = false;
book.addItem(obj);
}
}
]]>
</mx:Script>
</mx:Application>

Sponsored content



Back to top  Message [Page 1 of 1]

Permissions in this forum:
You cannot reply to topics in this forum