ComboBox with custom ItemRenderer
This is my combobox where I am trying to have a custom renderer:
<?xml version="1.0" encoding="utf-8"?>
<mx:ComboBox xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/halo">
<fx:Script>
<![CDATA[
import mx.events.FlexEvent;
import mx.collections.ArrayCollection;
import mx.controls.CheckBox;
public var datas:XML;
[Bindable]
var ItemRenderer:ClassFactory;
override public function set data(value:Object):void
dataProvider = datas["sku" + value.sku];
ItemRenderer = new ClassFactory(comboBoxCheckBoxItemRenderer);
itemRenderer = ItemRenderer;
public function saveCheckState(evt:Event):void
var dataProviderItem:Object = dataProvider.getItemAt(dataProvider.getItemIndex(selectedItem));
dataProviderItem.selected = CheckBox(evt.currentTarget).selected;
dataProvider.setItemAt(dataProviderItem, dataProvider.getItemIndex(selectedItem));
]]>
</fx:Script>
</mx:ComboBox>
This combobox is used as a custom itemrenderer in datagrid.
Here is code for comboBoxCheckBoxItemRenderer:
package modulecode
import mx.containers.HBox;
import mx.controls.CheckBox;
import mx.controls.Label;
import mx.controls.Spacer;
public class comboBoxCheckBoxItemRenderer extends HBox
private var action:Label;
private var spacer:Spacer;
private var checkBox:CheckBox;
public function comboBoxCheckBoxItemRenderer()
super();
override protected function createChildren():void {
// Call the createChildren() method of the superclass.
super.createChildren();
action = new Label();
// Add the child component to the custom component.
addChild(action);
spacer = new Spacer();
spacer.percentWidth = 100;
// Add the child component to the custom component.
addChild(spacer);
checkBox = new CheckBox();
// Add the child component to the custom component.
addChild(checkBox);
override public function set data(value:Object):void
action.text = value.action;
checkBox.selected = value.selected;
What's happening is that nothing is happening untill I drop combobox down in the grids. As the result checkboxes are not selected properly.
Any help?
How would I set up a custom itemrenderer to use data binding but properly have selected property in the following code:
<<mx:itemRenderer>
<fx:Component>
<mx:HBox width="100%">
<mx:Label text="{XML(data).action}"/>
<mx:Spacer width="100%"/>
<mx:CheckBox id="check" selected="{XML(data).selected}"
change="outerDocument.saveCheckState(event);"/>
</mx:HBox>
</fx:Component>
</mx:itemRenderer>
Similar Messages
-
Refresh combobox with custom display(Plug in)
Hello ,
I am using combobox with custom display(Plug in) in my application.
i want to display value in combobox on selection of values in radio item
sample query used in combobox like
if :Radio_item = 1 then
return 'SELECT NAME dropdown_display
,NAME search_string
,NAME input_display
,id return_value
FROM Table_A';
else
return 'SELECT NAME dropdown_display
,NAME search_string
,NAME input_display
,id return_value
FROM Table_B';
end if;
but problem is it is always showing the data from first query,it is not displaying the value from second query on changing of radio option.
i also tried to refresh the combobox item on change of radio item values but still it is showing the value from first query.
please help me how to resolve this issue.
Apex Version - 4.1.1
Database - 11g
Regards and thanks
JitendraShiv wrote:
Hi,
I used plugin "Combobox with Custom Display".
I have issue like
When i entered some text in textbox and scroll down using down key of key board. That highlighted part can not scroll down with scroll.
The demo link for above issue
http://apex.oracle.com/pls/apex/f?p=35538:4
kindly help me out.
ThanksIts a bug in the plugin code and not related to APEX.
I will look into it and fix my code to address this issue, please bookmark this page http://www.apex-plugin.com/oracle-apex-plugins/item-plugin/combobox-with-custom-display_212.html and check for updates.
Thanks,
Vikram -
How do I make a Custom DataTip with Custom ItemRenderer
I can't seem to find any documentation or examples of
displaying a dataTip (similar to those used with charting) with my
custom itemRenderer (mxml component). This is for use in a
dataGridColumn. I Could someone give me an example? The closest
I've been able to find is
http://www.mail-archive.com/[email protected]/msg61624.html,
which doesn't say how to do it.
Thanks!http://blog.bigfatstogie.com/?p=42
run the example towards the end of the page -
Drag-n-Drop problem in DataGrid with custom ItemRenderer
Hi,
I am trying to use a DataGrid to set the ordering of a group
of images.
I want to do this with a DataGrid which will show me some
properties of
the images in different columns including a thumbnail of the
image. The
problem is when I use any custom renderer for any column, the
draging is
not working. It works fine when I don't use any ItemRenderer.
My code looks something like this:
<mx:DataGrid dragEnabled= "true" dropEnabled= "true"
dragMoveEnabled= "true">
<mx:columns>
<mx:DataGridColumn headerText="Thumb" itemRenderer=
"component. GridImageRenderer"/>
<mx:DataGridColumn headerText="Current name" width="100"
itemRenderer= "component. NameRenderer" />
<mx:DataGridColumn headerText="New name" width="150"
dataField="nameNew" />
</mx:columns>
</mx:DataGrid>
Can anyone please give me any clue how to fix this?
Regards,
~ ArifHello again, BinaryDigit.
I thought we need to apply Drag n drop API for this case.
Without wasting too much time,
I tried out as your source code from the previous reply,,,
Instead of getting it clearly, I got another Confusion... (pardon me)
Let me clarify this with the examples given,
I try to adopt previous source code
and it was this detail;
1) Taking the X and Y coordinate (from the mouseEvent) Plus jLabel1 coordinate (both X and Y).
2) Positioning a Coordinate taken to JLabel1
3) Passing the Coordinate taken to jLabelX, and jLabelY.
The problem found was;
if we make 3rd become comments, now the jLabel1
could works!
I mean, jLabel1 could be dragged to another Coordinate (by dragging it to another location)
But,
if we un-comments the 3rd source code,
The effect would be no movement of the jLabel1.
BinaryDigit, is this related to the layout you mentioned before?
Correct, DarrylBurke! :D
I thought also the same thing,
but setLocation() give me another Confusion....
the coordinate seems taking its basement as a reference.
I mean, the jLabel Coordinate's is referenced
from the panel where the jLabel is attached to,
rather than the Coordinate's of the base jFrame (main base -what should I call this?)
Sorry, the Details number three (3) is my preference, Since I wanted to see the X, Y movements also. -
I'm having performance issues with a mobile application layout approach that consists of the following.
Pseudo code: (based on http://blogs.adobe.com/jasonsj/2011/11/mobile-list-paging-with-page-indicator-skin.html )
VIEW:
<View>
<script>
function getItemRenderer(data):IFactory {
return new ClassFactory(data.itemClass);
</script>
<List id="pageList" width="100%" height="100% itemRendererFunction="getItemRenderer">
<layout>
<TileLayout numRows="1" width="pageList.width" height="pageList.height" />
</layout>
</List>
</View>
ItemRenderer example:
<Scrollerwidth="100%"
height="100%">
<VGroup>
<s:Label fontWeight="bold" text="Name 1:" />
<s:HGroup paddingLeft="50" width="100%">
<s:TextInput width="100%" />
</s:HGroup>
<s:Label fontWeight="bold" text="Name 2:" />
<s:HGroup paddingLeft="50" width="100%">
<s:TextInput width="100%" />
</s:HGroup>
<s:Label fontWeight="bold" text="Name 3:" />
<s:HGroup paddingLeft="50" width="100%">
<s:TextInput width="100%" />
</s:HGroup>
<s:Label fontWeight="bold" text="Name 4:" />
<s:HGroup paddingLeft="50" width="100%">
<s:TextInput width="100%" />
</s:HGroup>
<s:Label fontWeight="bold" text="Name 5:" />
<s:HGroup paddingLeft="50" width="100%">
<s:TextInput width="100%" />
</s:HGroup>
<s:Label fontWeight="bold" text="Name 6:" />
<s:HGroup paddingLeft="50" width="100%">
<s:TextInput width="100%" />
</s:HGroup>
<s:Label fontWeight="bold" text="Name 7:" />
<s:HGroup paddingLeft="50" width="100%">
<s:TextInput width="100%" />
</s:HGroup>
<s:Label fontWeight="bold" text="Name 8:" />
<s:HGroup paddingLeft="50" width="100%">
<s:TextInput width="100%" />
</s:HGroup>
<s:Label fontWeight="bold" text="Name 9:" />
<s:HGroup paddingLeft="50" width="100%">
<s:TextInput width="100%" />
</s:HGroup>
<s:Label fontWeight="bold" text="Name 10:" />
<s:HGroup paddingLeft="50" width="100%">
<s:TextInput width="100%" />
</s:HGroup>
<s:Label fontWeight="bold" text="Name 11:" />
<s:HGroup paddingLeft="50" width="100%">
<s:TextInput width="100%" />
</s:HGroup>
<s:Label fontWeight="bold" text="Name 12:" />
<s:HGroup paddingLeft="50" width="100%">
<s:TextInput width="100%" />
</s:HGroup>
<s:Label fontWeight="bold" text="Name 13:" />
<s:HGroup paddingLeft="50" width="100%">
<s:TextInput width="100%" />
</s:HGroup>
<s:Label fontWeight="bold" text="Name 14:" />
<s:HGroup paddingLeft="50" width="100%">
<s:TextInput width="100%" />
</s:HGroup>
<s:Label fontWeight="bold" text="Name 15:" />
<s:HGroup paddingLeft="50" width="100%">
<s:TextInput width="100%" />
</s:HGroup>
<s:Label fontWeight="bold" text="Name 16:" />
<s:HGroup paddingLeft="50" width="100%">
<s:TextInput width="100%" />
</s:HGroup>
<s:Label fontWeight="bold" text="Name 17:" />
<s:HGroup paddingLeft="50" width="100%">
<s:TextInput width="100%" />
</s:HGroup>
<s:Label fontWeight="bold" text="Name 18:" />
<s:HGroup paddingLeft="50" width="100%">
<s:TextInput width="100%" />
</s:HGroup>
<s:Label fontWeight="bold" text="Name 19:" />
<s:HGroup paddingLeft="50" width="100%">
<s:TextInput width="100%" />
</s:HGroup>
<s:Label fontWeight="bold" text="Name 20:" />
<s:HGroup paddingLeft="50" width="100%">
<s:TextInput width="100%" />
</s:HGroup>
<s:Label fontWeight="bold" text="Name 21:" />
<s:HGroup paddingLeft="50" width="100%">
<s:TextInput width="100%" />
</s:HGroup>
<s:Label fontWeight="bold" text="Name 22:" />
<s:HGroup paddingLeft="50" width="100%">
<s:TextInput width="100%" />
</s:HGroup>
<s:Label fontWeight="bold" text="Name 23:" />
<s:HGroup paddingLeft="50" width="100%">
<s:TextInput width="100%" />
</s:HGroup>
<s:Label fontWeight="bold" text="Name 24:" />
<s:HGroup paddingLeft="50" width="100%">
<s:TextInput width="100%" />
</s:HGroup>
<s:Label fontWeight="bold" text="Name 25:" />
<s:HGroup paddingLeft="50" width="100%">
<s:TextInput width="100%" />
</s:HGroup>
<s:Label fontWeight="bold" text="Name 26:" />
<s:HGroup paddingLeft="50" width="100%">
<s:TextInput width="100%" />
</s:HGroup>
<s:Label fontWeight="bold" text="Name 27:" />
<s:HGroup paddingLeft="50" width="100%">
<s:TextInput width="100%" />
</s:HGroup>
<s:Label fontWeight="bold" text="Name 28:" />
<s:HGroup paddingLeft="50" width="100%">
<s:TextInput width="100%" />
</s:HGroup>
<s:Label fontWeight="bold" text="Name 29:" />
<s:HGroup paddingLeft="50" width="100%">
<s:TextInput width="100%" />
</s:HGroup>
<s:Label fontWeight="bold" text="Name 30:" />
<s:HGroup paddingLeft="50" width="100%">
<s:TextInput width="100%" />
</s:HGroup>
</VGroup>
</Scroller>
Basically, I have a lot of input fields, eventually also date choosers, and textareas in each of those item renderers.
Is there a reason this is not performing well ?
Is there something I can do to improve the performance ?Thanks for the hints.
Regarding TileLayout vs HorizontalLayout, I haven't seen much difference in performance.
But I did manage to make everything go faster **.
1st: not using the StageText on the TextInput's (changed that).
2nd: there was a font using CFF on the Label fields, which wasn't supported (changed that).
I'm not sure if those are what made the diff, but I'm happier!
**: Might be almost viable like this.
In all, I'm going to have about 7 custom item renderers in the List, but only 1 is visible at the time on screen (taking the whole visible area of the List). Some of the pages (i call them pages in such a case) will have some components that will be more elaborate, like permitting someone to do simple drawing within a region.
Yes, I'm imagining that the List component still will have them in memory and maybe recycle them if he's smart, thus making it heavy whenever it creates them. Would be interesting to see if I can optmize the creation of the itemrenderer instances. I'm still not that keen about using this approach of using a List to support such a user experience.
It would have loved it if the ViewNagivator could better support sliding between Views, but I understand it would require the ViewNavigator to know which View will be the next View, etc.. Maybe something like a ListNavigatorView or something like that
Details for now.
Regarding using a Edit mode, I'll keep that in mind and see if it makes sense in this app and how the user experience will be with such a mode.
Regarding using the HGroup for padding of the TextInput vs using a custom layout or custom component. You probably have a point. I'm kind of new to the Spark world, been using MX since Flex 2 and kind of got scared of the Spark world... No I'm diving head first. Thus, thanks for the hint on that. I'll digg and find some docs about the details on that!
Thanks again! -
ItemSelected does not come on TileList with custom IR
Hi everybody,
I've got a strange problem - TileList with custom ItemRenderer (IR) which consists of HBox and a Flash component sometimes is missing the mouse clicks.
The problem appears only with custom IR. I traced the mouse events -
"click" on IR
and "itemSelected" on TileList.
I already tried to set mouseEnabled=false on IR, to prevent it getting any mouse input, but it did not make any difference.
This behaviour is not 100% replicable, it comes & goes and I think that it does not depend on the click area on the IR.
PS ItemRenderer changes it's shape on mouseOver/Out ts, so I can see that when I click, IR at least gets mouseOver event.
Any ideas what could cause the disappearing of events or blocking it from bubbling to TileList?
Thanks!
Cheers,
Dmitri.You're sure that changing the shape of the item renderer isn't what's causing the confusion?
If you disable the shape changing does the behavior correct itself? I don't use IRs extensively but changing the shape sounds like it might be uncharted territory (i.e. unsupported/untested, may not work at all) however I could be wrong. -
Custom itemRenderer in a F3 ComboBox on specific list items after combobox creation
Hi,
I'm trying to set a specific list item in a mx combobox to have a custom item renderer, the problem is that I cannot do this via mxml, it needs to be done via actionscript at a later stage, eg: combobox gets created, combobox gets populated, user does other tasks, combobox needs to set one or more items in the combobox to have icons (via item renderer)..
I can do this via the onChange event, but it only applies the icon when the combobox is opened and there is a slight delay so you can see the icon being added.
Thanks in advance for any help
JHi,
If I understand correctly, you can create you comboBox with all items at the begining:
http://blog.flexexamples.com/2007/08/18/displaying-icons-in-a-flex-combobox-control/
After that, base on user task, you can filter you comboBox:
http://blog.flexexamples.com/2008/03/12/using-a-combobox-to-filter-items-in-a-datagrid-in- flex/
In this way you don't see the delay.
Johnny
Please rate answers. -
Size of combobox in JTable with custom cell editor
Hi All -
I have a JTable that displays a combobox in certain cells. I have a custom table model, renderer, and editor. All of that works fine. I render the combobox with the renderer, and then return the combobox as an editor in the editor so that it can drop down and actually be of use. My problem is - I set the size of the combobox with a setBounds call in the renderer, I add it to a panel, and return the panel - because I dont want the combobox to take up the entire space of the cell. This approach fails in the editor. The setBounds and setSize calls have no effect. As soon as you click the combobox, the editor takes over and all of a sudden the combobox resizes to the entire area of the cell. I assume this is because in the editor you arent actually placing anything - your simply returning the "editing form" of the component.
So - anybody know of a way to work around this? Worst case, I could just allow the combobox to use the entire area of the cell - but it makes it uglier so I figured I would run it by the forums.
EricRather than just redirect you to my previous answer from ages ago, I'll just give it again. :-)
You can actually do this, but you have to get tricky. By default, the dropdown's width will be the same width as the cell... but it doesn't have to be that way. Essentially what you have to do is override the UI (MetalComboBoxUI) for the combo component. In your new customized UI component subclass (that you set the combo to use), modify the the createPopup() method of this UI class, and add your own logic to set the size of the popup before you return it.
Ideally the size would be based on the computed max width of a rendered item shown in the combo, but really you could set it to whatever just to see how it works. -
A DataGrid with a Custom ItemRenderer
Hi all,
I have a DataGrid whose DataProvider is bound to a simple Array. I have a custom ItemRenderer that includes a button that can remove the item itself (I don't want two separate columns with a remove button in one of them). However, I don't understand the behaviour - clicking the button rearranges the data in the DataGrid and sometimes duplicate the entries! See the example attached. Any idea what's happening?
Martin.
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="onCreationComplete();" xmlns:local="*">
<mx:Script>
<![CDATA[
[Bindable]
public var _data : Array;
protected function onCreationComplete() : void {
_data = new Array();
_data.push(1, 2, 3, 4, 5);
]]>
</mx:Script>
<mx:VBox>
<mx:DataGrid dataProvider="{_data}">
<mx:columns>
<mx:DataGridColumn>
<mx:itemRenderer>
<mx:Component>
<mx:HBox implements="mx.controls.listClasses.IDropInListItemRenderer" creationComplete="dataLabel.text = String(data);">
<mx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
import mx.controls.DataGrid;
import mx.controls.listClasses.BaseListData;
protected var _listData : BaseListData;
public function get listData() : BaseListData {
return _listData;
public function set listData(d : BaseListData) : void {
_listData = d;
protected function onClick(e : Event) : void {
var dp : ArrayCollection = (owner as DataGrid).dataProvider as ArrayCollection;
dp.removeItemAt(listData.rowIndex);
]]>
</mx:Script>
<mx:Label id="dataLabel" width="100%" />
<mx:Button click="onClick(event);"/>
</mx:HBox>
</mx:Component>
</mx:itemRenderer>
</mx:DataGridColumn>
</mx:columns>
</mx:DataGrid>
</mx:VBox>
</mx:Application>creationComplete is rarely used in renderers. See the itemrenderer posts on my blog
Alex Harui
Flex SDK Developer
Adobe Systems Inc.
Blog: http://blogs.adobe.com/aharui -
Combobox with multiple columns
Is it possible to make a combobox with two columns in the dropdown area?
Thanksmake your own componen to show 2 colums... and assig it to combo box as itemrenderer...
twoColums.mxml:
<?xml version="1.0" encoding="utf-8"?>
<mx:HBox xmlns:mx="http://www.adobe.com/2006/mxml"
horizontalScrollPolicy="off" >
<mx:Text text="{data.Column1}" width="93">
</mx:Text>
<mx:Text text="{data.Column2}">
</mx:Text>
</mx:HBox>
in your main app or another custom conponen place your combobox like thi:
<mx:ComboBox id="myCB" dataProvider="{yourdata}" labelField="Column1"
itemRenderer = "components.twoColums">
</mx:ComboBox>
mybe you need to add width and dropdowwidth properties to show the items in a good way....hope this work..
PD. this works the same for Adobe autocomplete.. as autocomplete is a component heritated from combobox..:
make shure you have included the autocomplete component in your project at its says in the readme file included by Adobe then..
<Adobe:AutoComplete id="myCB" arrowButtonWidth = "30" dataProvider="{yourdata}" labelField="Column1"
itemRenderer = "components.twoColums">
</Adobe:AutoComplete>
note the arrowButtonWidth if you dont put this property the autocomplete will just show as a common text field...
remember auto complete will have some issues with the itemrenderer stuff.. if you wirite too fast, the first character you write will be lost, so calmd down, im traing to figure out how to soleve that issue...
haaaa by the way if you already have another way to show 2 columns please telme how you solve it... -
Items in Tree control move around when data is submitted using custom ItemRenderer
I'm working on a Tree control with an XMLListCollection as
its dataProvider.
The dataProvider has information looking like this :
quote:
<?xml version='1.0' encoding='utf-8'?>
<INFO>
<FIELD label="STR_USER_NAME"
type="text"
value=""
>
</FIELD>
<FIELD label="STR_USER_EMAIL"
type="text"
value=""
>
</FIELD>
<FIELD label="STR_OPTIONAL"
type="branch"
value="0"
>
<FIELD label="STR_USER_ADDRESS"
type="text"
value=""
>
</FIELD>
<FIELD label="STR_USER_POSTAL_CODE"
type="text"
value=""
>
</FIELD>
</FIELD>
</INFO>
So in the Tree control I'd like the information to show up
with a label and
an
editable textbox for each item :
[Label] [textbox]
To do this I made a tree like this :
quote:
<mx:Tree id="userTree"
editable="true"
rendererIsEditor="true"
editorDataField="curVal"
itemRenderer="{new ClassFactory(ItemRendererUser)}"
itemEditEnd="e_ProcessData(event);"
dataDescriptor="{new DataDescriptorUsers()}"
showRoot="false"
verticalScrollPolicy="{ScrollPolicy.AUTO}"
/>
where the e_ProcessData() function looks like this (I used
http://livedocs.adobe.com/flex/201/html/wwhelp/wwhimpl/js/html/wwhelp.htm?href=c
elleditor_073_16.html#202105 as a guide) :
quote:
public function e_ProcessData(event:ListEvent):void
event.preventDefault();
userTree.editedItemRenderer.data.@value =
ItemRendererUsers(event.currentTarget.itemEditorInstance).curVal;
userTree.destroyItemEditor();
userTree.dataProvider.notifyItemUpdate(userTree.editedItemRenderer);
} // END OF e_ProcessData()
I attached the rest of the files because they're a little
bit longer.
When I run the program, the data shows up fine when it is
initialized the
very
first time, and I made a test button that just dumps the
contents of the
dataProvider in a trace statement to verify that the data has
been set
properly.
The problem I've run into is whenever the textfield is
edited, the item
that
I've selected jumps around the list.
For example, if I edit the item "STR_USER_NAME" after I
finish the edit, it
will move from the very first position in the Tree to the
bottom of the
Tree.
I traced the contents of the dataProvider and the
dataProvider structure
stays
the same, with the "STR_USER_NAME" at the top, but if I look
at the flex app
in
the web browser, its position is at the bottom of the Tree.
This happens for every other item I try to edit... I read in
the
documentation
that the ItemRenderers are recycled, so it means I should be
checking to
make
sure the initial states are covered, but I'm not sure how
this affects my
application.
Can anyone help me out with this ? Its very confusing - I've
tried making
an
ItemRenderer using pure actionscript, mxml and the
combination you see in
this
example and I always end up with the same behaviour - So I
must be missing
something critical...
// ItemRendererUsers.mxml
<?xml version="1.0" encoding="utf-8"?>
<mx:Canvas xmlns:mx="
http://www.adobe.com/2006/mxml"
verticalScrollPolicy="{ScrollPolicy.OFF}"
horizontalScrollPolicy="{ScrollPolicy.OFF}"
creationComplete="initItemRendererUsers();"
>
From my FAQ:
Q: I've created a custom itemRenderer component to use in a
List
based component (Datagrid, TileList, HorizontalList, etc.).
When my List
first displays, everything looks fine, but when I scroll it
or change the
dataProvider, some of the itemRenderers show values or
formatting that
aren't right. How do I fix this?
A: List-based components don't draw a renderer for every item
in the
dataProvider. Instead, they create enough to display what is
on screen now,
plus one or two more waiting in the wings. This means they
recycle the
renderers rather than creating new ones when you change
dataProvider or
scroll up and down. When you use a creationComplete event to
set up the
itemRenderer, that event doesn't happen again when the
renderer is used for
a different set of data. The solution to this is to override
the set data
protected function that most components have.
For more information, check out the following resources:
http://www.adobe.com/devnet/flex/articles/itemrenderers_pt1.html?devcon=f1
http://blogs.adobe.com/aharui/2007/03/thinking_about_item_renderers_1.html
Please note, I post this FAQ weekly, and you can find a
permanent copy of it
here
http://www.magnoliamultimedia.com/flex_examples/Amys_Flex_FAQ.pdf"peterh8234" <[email protected]> wrote in
message
news:gaqttd$kft$[email protected]..
> Yes - the set and get functions are listed down below.
But the quirky
> behaviour
> is the same regardless of whether I override the set and
get functions or
> not.
>
> I noticed there was another variable called listData -
should I be using
> that
> one or the data variable to read and write to the
dataProvider ?
>
> // _data
> [Bindable] public var _data:Object;
> [Bindable("dataChange")]
> //
> override public function get data():Object
> {
> trace('[ItemRendererDefault.GET data()] called for {' +
> _data.attribute("label") + '}.');
> return _data;
> } // END OF get data()
>
> //
> override public function set data(value:Object):void
> {
> _data.@value = inputText.text;
> trace('[ItemRendererDefault.SET data()] called for {' +
> _data.attribute("label") + '}.');
>
> invalidateProperties();
> } // END OF set data()
Your set data needs to set a flag that gets picked up in
commitProperties()
and does your thing that you were doing before in
creationComplete. You
should see examples of this in the links I posted. Instead of
this:
_data.@value = inputText.text;
you should look at implementing IDropInListItemRenderer,
which will allow
you to dynamically determine which field to look at, instead
of hardcoding
it. You also might wind up overwriting the stored value with
a null value
when the List passes the stored value in. I'd encourage you
to really go
through those links I posted and make sure you understand
what they're
saying. The itemRenderer life cycle is one of the hardest
things to
understand, but once you understand it, it makes many things
in Flex much
easier. It's worth investing the time. -
ComboBox with Lovs on Jdev 11g r2
I'm facing this Error on JSF on Jdeveloper 11g r2, Windows7.
I'm Using a ComboBox with Lovs on af:table.
I'm getting this Error below when I invoke the (Search) option... to see the popup list.
it works fine in every other case, if I select from the small list works ok, enter the text works ok. everything but the search option.
thank you for any help.
JBO-29114 ADFContext is not setup to process message for this exception.
Use the exception stack trace and error code to ivestigate the root cause
of this exception. Root cause error code is JBO-29000.
<LifecycleImpl> <_handleException> ADF_FACES-60098:Faces lifecycle receives unhandled exceptions in phase RENDER_RESPONSE 6
oracle.jbo.JboException: JBO-29000: Unexpected exception caught: java.lang.NullPointerException, msg=Cannot invoke method minus() on null object
at oracle.jbo.ExprEval.internalEvaluateGroovyScript(ExprEval.java:1218)
at oracle.jbo.ExprEval.doEvaluate(ExprEval.java:1253)
at oracle.jbo.ExprEval.evaluateForRow(ExprEval.java:1075)
at oracle.jbo.server.ViewObjectImpl.createViewAccessorRS(ViewObjectImpl.java:16203)I'm not Using a custom seach.....
I just define my LOV using a Model Driven List. and select Option ComboBox with Lovs.....
the lov with the issue belong to a detail table. I got several ComboBoxes working fine in similar model.... master/detail and the lov in the detail table.
thank you -
Forcing custom itemRenderer to updateDisplayList?
Hi, I'm new to flex, and was having some trouble.
In my project, I have a DataGrid, and a
BarChart->BarSeries. The DataGrid and the BarSeries share the
same DataProvider. I've made a custom itemRenderer, so that I can
click on Bars in the BarSeries and have them be highlighted in
black. This is done by having the itemRenderer listen for a CLICK
event, changing a variable that stores what color I want, then
calling invalidateDisplayList() to have updateDisplayList update
the display.
Since DataGrid and BarSeries share the same DataProvider,
elements in the DataGrid match up with elements in the BarSeries.
Therefore, I would like to be able to have a user click on an item
in the DataGrid, and have the associated bar in the BarSeries chart
become highlighted. However, I can't find a way to get the
itemRenderer to call updateDisplayList from outside of the
itemRenderer itself. I thought that calling invalidateDisplayList()
using the BarChart's id or the BarSeries id would force the
itemRenderer for the BarSeries to call updateDisplayList() and
update itself, but by using the debug feature, I have found that it
does not do this. Does anyone have any advice for how I would be
able to click on a DataGrid item and have it highlight the
corresponding item in the BarChart?
Thanks!Hi, I'm new to flex, and was having some trouble.
In my project, I have a DataGrid, and a
BarChart->BarSeries. The DataGrid and the BarSeries share the
same DataProvider. I've made a custom itemRenderer, so that I can
click on Bars in the BarSeries and have them be highlighted in
black. This is done by having the itemRenderer listen for a CLICK
event, changing a variable that stores what color I want, then
calling invalidateDisplayList() to have updateDisplayList update
the display.
Since DataGrid and BarSeries share the same DataProvider,
elements in the DataGrid match up with elements in the BarSeries.
Therefore, I would like to be able to have a user click on an item
in the DataGrid, and have the associated bar in the BarSeries chart
become highlighted. However, I can't find a way to get the
itemRenderer to call updateDisplayList from outside of the
itemRenderer itself. I thought that calling invalidateDisplayList()
using the BarChart's id or the BarSeries id would force the
itemRenderer for the BarSeries to call updateDisplayList() and
update itself, but by using the debug feature, I have found that it
does not do this. Does anyone have any advice for how I would be
able to click on a DataGrid item and have it highlight the
corresponding item in the BarChart?
Thanks! -
How To Update Custom ItemRenderer (Image) on DataGrid Edit
I have an DataGrid with 2 columns, column 1 called "Name" and column 2 called "Actions".
The "Name" column contains editable text and the "Actions" column uses a (inline) custom ItemRenderer which displays 2 icon images ( for Edit and Delete). All works fine. Clicking Edit or Delete calls the corrosponding outerDocument method.
The feature I am trying to add is as follows: when someone double-clicks on the text in the Name column to edit it, I would like the edit icon in the Actions column to ( grow/shrink, change color - or some such indication/reminder to click it ). Not seeing how to do this with the inline ItemRenderer, I created a custom item renderer class and, in that class, use mx:Resize to perform the "grow/shrink". I created a method called "pulse()" and, from within that renderer, all works well. ( for testing, I wired the icons click event to the pulse() method ). However, now I am not sure how to call that ItemRenderers "pulse()" method to perform the effect from the main DataGrid (when the user double-clicks on Name field to edit).
The tried using the DataGrid's "itemEditBegin", which fires correctly, but from that point I am not sure how to access the selected rows edit icon in the "Action" column. ( to call its pulse() ) method.
So any suggestions how I can achieve my end result? Being able to manipulate the edit icon in the "Actions" column, when the user double-clicks (edits) that row's "Name" column?
If I'm going about it all wrong, feel free to offer alternative solutions.
Any help would be appreciated.
Thanks,
~eHi,
Check the BAPI_MATERIAL_SAVEDATA ,in the BAPI is there a table parameter EXTENSIONIN ?
which you can use to pass the values for user defined fields to the BAPI..
Regards
Kiran Sure -
Custom itemRenderer - Bug?
Hi, I have an example of some code that I can't figure out.
What I'm doing may not be the best way to do what I want, but I
believe is should work, and can't figure out why it doesn't. I have
a datagrid with two columns, and the second column uses a custom
itemRenderer to draw multiple circles depending on nested XML data
for that row. In the
set data function of my itemRenderer, I'm trying to get the
width of the column, and use that to calculate where to put my
circle, as a value of 1 to 10.
- The first time, the
set data is called four times where there are three rows
- The first time it's called, this.width is zero
- When resizing column widths, set data is called again - the
first time only for the 2nd and 3rd rows, but with the correct
width
- Subsequent times it's called for all three rows, but the
first row uses the LAST width, not the new width
Any ideas? Here's my code:
Project name is FlexSample, first file is FlexSample.mxml,
then other two files are MyComponents/MyItemRenderer.as and
MyComponents/PointComponent.as
FlexSample.mxml
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="
http://www.adobe.com/2006/mxml"
xmlns="*"
width="100%" height="100%"
initialize="init()" horizontalGap="0" verticalGap="0" >
<mx:Script>
<![CDATA[
import mx.events.ResizeEvent;
import mx.controls.Alert;
import mx.rpc.events.ResultEvent;
import mx.rpc.events.FaultEvent;
import mx.rpc.http.HTTPService;
import mx.events.*;
[Bindable]
public var myXML:XML=
<ROWSET>
<ROW>
<POINTS>
<POINT>
<POINT_ID>90686</POINT_ID>
<X_VALUE>2</X_VALUE>
</POINT>
<POINT>
<POINT_ID>90806</POINT_ID>
<X_VALUE>8</X_VALUE>
</POINT>
</POINTS>
<NOTE_TX>Points are 2 and 8</NOTE_TX>
</ROW>
<ROW>
<POINTS>
<POINT>
<POINT_ID>90111</POINT_ID>
<X_VALUE>4</X_VALUE>
</POINT>
<POINT>
<POINT_ID>90222</POINT_ID>
<X_VALUE>6</X_VALUE>
</POINT>
</POINTS>
<NOTE_TX>Points are 4 and 6</NOTE_TX>
</ROW>
<ROW>
<POINTS>
<POINT>
<POINT_ID>90333</POINT_ID>
<X_VALUE>1</X_VALUE>
</POINT>
<POINT>
<POINT_ID>90444</POINT_ID>
<X_VALUE>10</X_VALUE>
</POINT>
</POINTS>
<NOTE_TX>Points are 1 and 10</NOTE_TX>
</ROW>
</ROWSET>;
]]>
</mx:Script>
<mx:DataGrid width="100%" height="100%" id="dgMain"
dataProvider="{myXML.ROW}"
fontFamily="Verdana" fontSize="10" color="#000066">
<mx:columns>
<mx:DataGridColumn headerText="Note"
dataField="NOTE_TX"/>
<mx:DataGridColumn headerText="Points" dataField="POINT"
id="dgcPoints"
itemRenderer="MyComponents.MyItemRenderer"/>
</mx:columns>
</mx:DataGrid>
</mx:Application>
MyItemRenderer.as
// ActionScript file
package MyComponents {
import mx.controls.*;
import mx.core.*;
import mx.controls.dataGridClasses.DataGridListData;
import mx.controls.listClasses.*;
import flash.display.*;
import mx.core.*;
import mx.controls.*;
import flash.events.*;
import mx.managers.PopUpManager;
import mx.events.*;
public class MyItemRenderer extends mx.core.Container
implements IListItemRenderer{
public function MyItemRenderer() {
super();
override public function set data(oValue:Object):void {
this.removeAllChildren();
//oValue contains whole ROW in XML format...
var n:int = 0;
if(this.width==0){
trace("set data:width 0!");
if (oValue != null && this.width>0) {
var m:int = this.getChildren().length;
var nWidth:int = this.width;
var xXML:XML = new XML(oValue);
for(var s:String in xXML.POINTS.children()){
var nXValue:int = xXML.POINTS.children()[s].X_VALUE;
//Total width is from 0-9, padding of 5 on left and right to
account for circle width
var n:int = (((nXValue -1)/10) * (this.width-10)) + 5;
trace("set data: Width:" + this.width + " XValue:" + nXValue
+ " X:" + n);
var u:PointComponent = new PointComponent(0x0000EE, n);
this.addChild(u);
PointComponent.as
package MyComponents
import mx.core.UIComponent;
import mx.controls.Alert;
public class PointComponent extends UIComponent
public function PointComponent(pnColor:uint, pnX:int){
super();
graphics.clear();
graphics.beginFill(pnColor);
graphics.drawCircle(pnX, 10, 7);
}A complete runnable example, that's great, I will give it a
try.
In the meantime, for "...set data is called four times where
there are three rows...", I have noticed this as well but have no
explanation. The first time, the "value" object is "null", so I
always wrap the code in if (value != null) {}
I'll post when I get a chance to look at your sample.
Tracy
Maybe you are looking for
-
hi all i am getting this error while running the report in WAD "System error in program SAPLRRS2 and form SELOPT_ASSIGN-01- " what does this error means and what steps i shuld follow? shalini
-
This just started happening to me the morning. I launch safari, the window opens but remains blank and I get the beachball forever. Tried deleting preferences for safari, have also reinstalled safari completely. Tried safari in a new user account and
-
Hi ,my name Nak I want to remove Object 3D from the scene. But shadow and physics is don't remove.
-
I need to build in my apex abblication (4.1) an easy user interface (graphics would be better) to build a logical expression. ie. ((A AND B) OR C) AND (D OR E) The user should be able to select from a list the "objects" (A, B, C,D,E) and the operato
-
Photoshop Premiere Elements 12: Can not burn a DVD
It works and said that DVD is burned, but no data are on DVD. I have choosed it with different DVD burners. The function "Burn to a folder" generate two new folders, but if I burn them to DVD the player can not read it. The only possibility to burn i