Databinding problem with Spark DropDownList
OK, after several hours, I give up. I'm missing something. I have a dataProvider for a form that works great. I have a manager and model that get updated based on events and all the other controls bind fine when I change the model. However, the Spark DropDownList doesn't work in the sense that when I change another list's selectedItem, it should update the dropDownList dataprovider and selectedItem. The dataProvider changes fine but nothing I do can seem to refresh the selectedItem on every other change! - though it's there for the choosing.
To baffle me even more, the mx:combobox works fine using the same but not the s:combobox. I'm just trying to find a Spark component that works the same as the mx:comboBox but they're not binding the same way with the same code.
Using nightly build with suggested changes to 10 and minorPlayerVersion
Please post a small test case.
Similar Messages
-
Squiggly_p4, problem with Spark Container
Hi,
Environment: Flex SDK 4.5 Hero, Win7 64 bit, Flash Builder 4
Code snippet
<s:Panel>
<mx:TextArea id="myTextArea" width="300" height="200" />
</s:Panel>
<s:TitleWindow>
<mx:TextArea id="myTextArea" width="300" height="200" />
</s:TitleWindow>
Result:
There are no suggestions for thos Halo TextArea if it belongs to Spark Container.
Maybe: ContextMenu is not initialized or not intialized properly.
Thanks,
JingThis is a known issue with spark panels. Please refer to http://forums.adobe.com/thread/706416?tstart=0
Thanks,
Ravi -
UiXML: dataBinding problem with decimal validator
I'm trying to use the decimal validator inside a uit template and dataBind the minValue, maxValue, maxScale and maxPrecision attributes to the ui:rootAttr dataObject like so:
<textInput ...>
<onSubmitValidater>
<decimal
data:minValue="minValue@ui:rootAttr"
data:maxValue="maxValue@ui:rootAttr"
data:maxPrecision="maxPrecision@ui:rootAttr"
data:maxScale="maxScale@ui:rootAttr"/>
</onSubmitValidater>
</textInput>
However that doesn't seem to work the validation never executes.
But when I don't use dataBinding it works fine.
Example:
<textInput ...>
<onSubmitValidater>
<decimal
minValue="0"
maxValue="10"
maxPrecision="2"
maxScale="3"/>
</onSubmitValidater>
</textInput>
Could it be that there is some bug with the decimal validator? I'm using the dateValidator in just the same way and it works fine.
GuidoWe'll at least warn you of the problem starting in 9.0.5.
Getting full databinding support in there may not happen
by then.
But there is a workaround today: databind the
onSubmitValidater attribute:
<textInput data:onSubmitValidater="decimal@someBean"/>
... to point to code that directly creates the
DecimalValidater.
public ClientValidater getDecimal()
DecimalValidater validater = new DecimalValidater();
validater.setMinValue(1.0);
// etc...
return validater; -
Problem with spark:resize effect and constraint-layout
Hi,
maybe its just a missuderstanding, but how i an get this to work.
Also move effects doesnt seem to work.
Does somebody have a Link, where I can get deeeper in constraints and spark.effects?
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
minWidth="955" minHeight="600"
width="100%" height="100%"
currentState="State1"
initialize="init()">
<s:layout>
<s:BasicLayout/>
</s:layout>
<fx:Script>
<![CDATA[
import flash.utils.Timer;
import flash.events.TimerEvent;
import flash.events.Event;
private var timer:Timer;
private function init():void {
timer = new Timer(5000);
timer.addEventListener(TimerEvent.TIMER, switcher);
timer.start();
public function switcher(event:TimerEvent):void {
if (currentState =="State1") {
currentState = "State2";
} else {
currentState = "State1";
]]>
</fx:Script>
<s:states>
<s:State name="State1"/>
<s:State name="State2"/>
</s:states>
<s:transitions>
<s:Transition fromState="State1" toState="State2">
<s:Resize target="{mainPanel}" />
</s:Transition>
<s:Transition fromState="State2" toState="State1">
<s:Resize target="{mainPanel}" />
</s:Transition>
</s:transitions>
<s:Panel id="mainPanel"
horizontalCenter="0" verticalCenter="0"
width.State1="250" height.State1="200"
horizontalCenter.State2="0" verticalCenter.State2="0"
left.State2="20" right.State2="20" top.State2="10" bottom.State2="50">
</s:Panel>
</s:Application>I think there are bugs in this area for transitioning an objects size between states where two different sizing mechanisms are in play.
If you transition from constraints to constraints or from width/height to width/height it should work better:
<s:Panel id="mainPanel"
horizontalCenter="0" verticalCenter="0"
left.State1="200" right.State1="200" top.State1="100" bottom.State1="500"
left.State2="20" right.State2="20" top.State2="10" bottom.State2="50"> -
Problem with this version of DropDownLists, there is no removeItem function
Dear All,
I have a problem with this new version of the DropDownLists, in previous versions you had the removeItem function and others, but now you just have clearItems and addItem.
I have a list of elements in which a customer will be able to link and delete any element that he wants, I had selected a DropDownList to do that but considering that the removeItem function is not present I dont know how to do that...
Does anybody know how to delete a element in a dropdownlist?
If not, the solution will be to get all the elements in an array and reload the list but without the element "deleted" . Does anybody knows how to get all the elements of a DropDownList?
Thanks
Ruben.If you have a drop-down list named myDropDownList,with SOMExpression
Form.page1.myDropDownList then you can remove the
element at position
i using the following code:
var myItems = xfa.form.resolveNode("Form.page1.myDropDownList.#items");
myItems.nodes.remove(myItems.nodes.item(i));
Good luck. -
Problems with MagSafe Adapter including sparks
When I plug my adapter into the plug socket I always see white sparks when plugging it into an extension lead. Is that normal or safe?
Also I have been having problems with the magsafe as when plugging it into my Mac Book Pro it doesn't always charge and you have to fiddle around with the wire to get it to start charging or unplug it a few times. I am also finding the magsafe bit is getting extremely hot as is the Mac Book Pro itself. Even when using it for simple web browsing. The CPU sometimes reaches 90° as well.
I have also been experiencing quite a lot of freezing / crashing / lagging on my mac book recently as well. Could this be related?
Should I take this to an apple store?I have had a similar problem. There are a few questions you might want to answer:
1. Does your MBP have any fraying cables or wires? If so, you should replace the Magsafe power adapter as quickly as possible. This can damage your laptop, eventually.
2. Is your "Magsafe" an original unit? If it's a knock-off, this could account for electrical instability.
3. Does your Magsafe power adapter take power directly from the wall socket, or do you have multiple plugs? Sparks or heat indicate that the adapter is taking in a large amount of energy - that may not be fully grounded.
I mention these questions because I hope to spur more questions, which might eventually solve your problem. I have no idea whether the freezing and crashing is related to your problem, but it's certainly possible. I would strongly suggest writing detailed notes of the problem, and then proceed to the Apple Store. -
Extend spark dropdownlist button to the longest item in dataprovider ?
Hi,
simple as stated in the thread's title : I cannot figure out a way to have my spark DropDownLists (no particular skin) extend their width to their longest item width ??
For instance the following :
<s:DropDownList id="aglist" width="100%" requireSelection="false"
dataProvider="{model.userAssignedAgents}" labelFunction="agentLabel"
change="aglist_changeHandler(event)" open="{aglist.selectedIndex = -1}"/>
when layed on a simple spark panel gets the standard DDList button width, about 50px whatever its content, though its items are much longer than that. So when the button is clicked, the dropdown menu shows some ugly scrollbars.
Do you have any clue ? I've been stuck for hours trying to do what sounds like the very-standard-way-of-setting-dropdownlist-width to me !
Thanks
MattGood point.
The main problem I had with the ComboBox is that I don't want to allow "creation" of new elements, so if the typed text doesn't match any element, instead of selectedIndex of -3 it should just keep the old selection. Plus a few other things.
Thinking about it, this is probably my best choice, and if I were to extend a class it should probably be this one. -
Relationship between a Spark DropDownList's dataProvider and selectedItem
I'm working on an existing project and have come across a somewhat complicated issue regarding a Spark DropDownList's (actually, a custom component inheriting from it) displayed item not changing when its dataProvider is updated.
Here's the code for the custom TitleWindow component containing the custom DropDownList:
<?xml version="1.0" encoding="utf-8"?>
<components:RFTitleWindow xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
xmlns:components="components.*"
xmlns:rfform="rfform.*"
width="550" height="450"
title="{currentState} Site Equipment"
cancelButton="{btnCancel}"
defaultButton="{btnSave}"
initialFocus="{rftName}"
creationComplete="init()" close="cancelEdit()">
<fx:Script>
<![CDATA[
import events.SiteEquipmentEvent;
import events.SiteEquipmentTypeEvent;
import mx.collections.ArrayList;
import mx.controls.Menu;
import mx.core.FlexGlobals;
import mx.core.UIComponent;
import mx.events.MenuEvent;
import mx.managers.PopUpManager;
import mx.validators.ValidationResult;
import mx.validators.Validator;
import spark.events.IndexChangeEvent;
private const TYPES:Array = ["A", "B", "C", "D"];
[Bindable] [Embed(source="../assets/images/circle_red_x.gif")] private var icoRedX:Class;
[Bindable] private var siteEquipment:SiteEquipment;
private var validators:Array;
private var typePopUp:Menu;
public static function open(item:SiteEquipment):SiteEquipmentEdit
var s:SiteEquipmentEdit = new SiteEquipmentEdit();
s.siteEquipment = item;
PopUpManager.addPopUp(s, DisplayObject(FlexGlobals.topLevelApplication), true);
PopUpManager.centerPopUp(s);
return s;
private function init():void
initTypePopUp();
if (siteEquipment.id == SiteEquipment.NEW_ID)
currentState = "New";
else
currentState = "Edit";
validateAll();
if (!rftName.enabled)
rfcmbType.setFocus();
siteEquipment.addEventListener(SiteEquipmentEvent.SITE_EQUIPMENT_SAVE, saveComplete);
override public function dispose(event:Event = null):void
super.dispose();
siteEquipment.removeEventListener(SiteEquipmentEvent.SITE_EQUIPMENT_SAVE, saveComplete);
typePopUp.removeEventListener("itemClick", typePopUp_click);
siteEquipment.dispose();
icoRedX = null;
siteEquipment = null;
validators = null;
typePopUp = null;
removeChildren();
private function cancelEdit():void
siteEquipment.cancelEdit();
private function saveForm():void
var newValue:SiteEquipment = new SiteEquipment();
newValue.id = siteEquipment.id;
newValue.locid = siteEquipment.locid;
newValue.name = rftName.trimmedText;
siteEquipment.save(newValue);
private function saveComplete(event:Event):void
dispose();
private function typePopUp_click(event:MenuEvent):void
switch(event.item)
case "Edit Selected Type":
SiteEquipmentType(rfcmbType.selectedItem).showEditForm();
break;
case "Create A New Type":
new SiteEquipmentType().showEditForm(type_created, null, type_removeListeners);
break;
private function type_created(event:SiteEquipmentTypeEvent = null):void
type_removeListeners(event);
rfcmbType.selectedItem = event.siteEquipmentType;
private function type_removeListeners(event:Event):void
var s:SiteEquipmentType = SiteEquipmentType(event.target);
s.removeEventListener(SiteEquipmentTypeEvent.SITE_EQUIPMENT_TYPE_CREATE, type_created);
s.removeEventListener(SiteEquipmentType.SITE_EQUIPMENT_TYPE_CANCEL, type_removeListeners);
private function initTypePopUp():void
typePopUp = Menu.createMenu(puType, ['Edit Selected Type', 'Create A New Type']);
typePopUp.addEventListener("itemClick", typePopUp_click);
private function popupTypeOptions():void
var p:Point = puType.localToGlobal(new Point(0, puType.height + 5));
typePopUp.show(p.x, p.y);
private function validateAll():void
var isValid:Boolean;
for each (var validator:Validator in validators)
isValid = true;
for each (var result:ValidationResult in validator.validate().results)
if (result.isError)
isValid = false;
break;
UIComponent(validator.source).styleName = "valid_" + isValid.toString();
private function rfcmbType_changeHandler(event:IndexChangeEvent):void
if (TYPES.indexOf(SiteEquipmentType(RFDropDownList(event.target).selectedItem).name) > -1)
rftName.text = "Blah";
rftName.enabled = false;
else
rftName.enabled = true;
]]>
</fx:Script>
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
<s:DateTimeFormatter id="mdy"
dateTimePattern="MM/dd/yyyy"/>
</fx:Declarations>
<components:states>
<s:State name="Edit"/>
<s:State name="New"/>
</components:states>
<rfform:RFForm width="100%" height="100%"
saveButton="{btnSave}"
validators="{new ArrayList([valQuantity, valHeight])}">
<rfform:RFFormItem label="Type"
width="100%">
<s:HGroup width="100%">
<rfform:RFDropDownList id="rfcmbType"
width="100%"
originalValue="{siteEquipment.model.eqType}"
dataProvider="{SiteEquipmentType.all}"
change="rfcmbType_changeHandler(event)"/>
<rfform:RFButton id="puType"
icon="@Embed(source='/Shared/src/assets/images/settings.png')"
width="30"
click="popupTypeOptions()"/>
</s:HGroup>
</rfform:RFFormItem>
</rfform:RFForm>
</components:RFTitleWindow>
I've omitted a little bit of code, so please ask if you need anything that I didn't include.
In regards to the RFDropDownList, originalValue is saved so that when a new selection is made, the new selection can be compared to the original value. Setting originalValue sets the RFDropDownList's selectedItem to originalValue.
When this window is first opened, a new instance of SiteEquipment is created. Unless the equipment is new, the SiteEquipment instance sets the SiteEquipmentType to whatever has already been saved, using this line:
eqType = SiteEquipmentType.selectFromObject(item.SITE_EQUIPMENT_TYPE);
And here's the code from the SiteEquipmentType class:
package components
import common.UpdateStatus;
import events.SiteEquipmentTypeEvent;
import scripts.MyUtility;
import flash.events.Event;
import flash.events.EventDispatcher;
import flash.utils.setTimeout;
import mx.collections.ArrayCollection;
import mx.collections.Sort;
import mx.collections.SortField;
import mx.controls.Alert;
import mx.rpc.events.ResultEvent;
import mx.utils.ObjectProxy;
[Event(name="cacheChanged", type="flash.events.Event")]
[Event(name="SITE_EQUIPMENT_TYPE_CREATE", type="events.SiteEquipmentTypeEvent")]
[Event(name="SITE_EQUIPMENT_TYPE_EDIT", type="events.SiteEquipmentTypeEvent")]
[Event(name="SITE_EQUIPMENT_TYPE_CANCEL", type="flash.events.Event")]
public class SiteEquipmentType extends ObjectProxy
public static const NEW_ID:int = -1;
public static const SITE_EQUIPMENT_TYPE_CANCEL:String = "siteEquipmentTypeCancel";
[Bindable]
public var id:int = NEW_ID;
[DefaultProperty]
[Bindable]
public var name:String = "";
private static var dict:Object = new Object();
private static var getAllServiceCalled:Boolean = false;
private static var eventDispatcher:EventDispatcher = new EventDispatcher();
private var updateStatus:UpdateStatus = UpdateStatus.COMPLETE;
public function SiteEquipmentType(item:Object = null, keepInCache:Boolean = true)
if (item == null)
return;
else if (item is int)
id = int(item);
refreshFromDb();
else
updateFromResult(item);
if (keepInCache)
addToCache(this);
private static var _all:ArrayCollection = new ArrayCollection();
public static function get all():ArrayCollection
if (!getAllServiceCalled)
getAllServiceCalled = true;
MyUtility.httpPost("/page.aspx", {request:"SITE_EQUIPMENT_TYPE"}, getAll_result);
var s:Sort = new Sort();
s.fields = [new SortField("name", true)];
_all.sort = s;
return _all;
public static function addEventListener(type:String, listener:Function):void
eventDispatcher.addEventListener(type, listener);
public static function removeEventListener(type:String, listener:Function):void
eventDispatcher.removeEventListener(type, listener);
public static function dispatchEvent(event:Event):Boolean
return eventDispatcher.dispatchEvent(event);
private static function addToCache(item:SiteEquipmentType):void
removeFromCache(item.id);
dict[item.id] = item;
_all.addItem(item);
dispatchEvent(new Event("cacheChanged"));
private static function removeFromCache(id:int):void
var item:SiteEquipmentType = dict[id];
if (item)
delete dict[id];
_all.removeItemAt(_all.getItemIndex(item));
public static function selectById(id:int):SiteEquipmentType
if (dict[id])
return dict[id];
return new SiteEquipmentType(id);
public static function selectFromObject(obj:Object):SiteEquipmentType
var selected:SiteEquipmentType;
var objId:int = obj.SITE_EQUIPMENT_TYPE_ID;
if (dict[objId])
selected = dict[objId];
selected.updateFromResult(obj);
else
selected = new SiteEquipmentType(obj);
return selected;
private function updateFromResult(item:Object):void
if (item)
id = item.SITE_EQUIPMENT_TYPE_ID;
name = item.SITE_EQUIPMENT_TYPE_NAME;
private function toRequestObject():Object
var o:Object = new Object();
o.SITE_EQUIPMENT_TYPE_ID = id;
o.SITE_EQUIPMENT_TYPE_NAME = name;
return o;
public function copy():SiteEquipmentType
return new SiteEquipmentType(this.toRequestObject());
public function save(value:SiteEquipmentType):void
if (updateStatus == UpdateStatus.PENDING)
Alert.show("Site Equipment Type is pending an update.", "Pending Update");
return;
else if (updateStatus == UpdateStatus.ERROR)
Alert.show("There is a problem with this Site Equipment Type, and it cannot be saved. Please close the window.", "Save Failure");
return;
var request:Object;
if (id == NEW_ID)
if (value)
request = value.toRequestObject();
else
request = toRequestObject();
request._COMMAND = "INSERT";
else
if (value)
request = MyUtility.objectDiff(this.toRequestObject(), value.toRequestObject());
if (!request)
dispatchEvent(new SiteEquipmentTypeEvent(SiteEquipmentTypeEvent.SITE_EQUIPMENT_TYPE_CREATE, this));
return;
else
request = toRequestObject();
request._COMMAND = "UPDATE";
request._SITE_EQUIPMENT_TYPE_ID = id;
delete request.SITE_EQUIPMENT_TYPE_ID;
updateStatus = UpdateStatus.PENDING;
MyUtility.httpPost("/updatetable.aspx?_SCHEMA=dbo&_TABLENAME=SITE_EQUIPMENT_TYPE&_RETURNRECORD=1", request, httpSave_result);
public function toString():String
return name;
public function refreshFromDb():void
if (updateStatus != UpdateStatus.PENDING)
updateStatus = UpdateStatus.PENDING;
MyUtility.httpPost("/page.aspx", {id:id, request:"Site_Equipment_Type"}, httpSelect_result);
public function showEditForm(onCreate:Function = null, onEdit:Function = null, onCancel:Function = null):void
if (id == 0)
Alert.show("Edits are not allowed on this Site Equipment Type.", "Not Allowed");
return;
if (onCreate != null)
addEventListener(SiteEquipmentTypeEvent.SITE_EQUIPMENT_TYPE_CREATE, onCreate);
if (onEdit != null)
addEventListener(SiteEquipmentTypeEvent.SITE_EQUIPMENT_TYPE_EDIT, onEdit);
if (onCancel != null)
addEventListener(SITE_EQUIPMENT_TYPE_CANCEL, onCancel);
if (updateStatus == UpdateStatus.PENDING)
setTimeout(showEditForm, 500);
else if (updateStatus == UpdateStatus.COMPLETE)
SiteEquipmentTypeEdit.open(this);
public function cancelEdit():void
dispatchEvent(new Event(SITE_EQUIPMENT_TYPE_CANCEL));
private static function getAll_result(event:ResultEvent):void
if (event.result.ROOT)
if (event.result.ROOT.ERROR)
Alert.show(event.result.ROOT.ERROR, "Error");
else
for each (var o:Object in MyUtility.ToArrayCollection(event.result.ROOT.SITE_EQUIPMENT_TYPE))
var i:SiteEquipmentType = dict[o.SITE_EQUIPMENT_TYPE_ID];
// If the Site Equipment Type is already in the cache, update it based on the XML returned
if (i)
i.updateFromResult(o);
// Otherwise, create a new one from the XML returned
else
i = new SiteEquipmentType(o);
_all.refresh();
private function httpSelect_result(event:ResultEvent):void
if (event.result.ROOT)
if (event.result.ROOT.ERROR)
Alert.show(event.result.ROOT.ERROR, "Error");
updateStatus = UpdateStatus.ERROR;
else
updateFromResult(event.result.ROOT.SITE_EQUIPMENT_TYPE);
updateStatus = UpdateStatus.COMPLETE;
else
updateStatus = UpdateStatus.ERROR;
private function httpSave_result(event:ResultEvent):void
if (event.result.ROOT.ERROR)
Alert.show(event.result.ROOT.ERROR, "Error");
updateStatus = UpdateStatus.ERROR;
else
try
updateStatus = UpdateStatus.COMPLETE;
if (id == NEW_ID)
id = event.result.ROOT.RESULTS.IDENTITY;
addToCache(this);
updateFromResult(event.result.ROOT["DBO.SITE_EQUIPMENT_TYPE"]);
dispatchEvent(new SiteEquipmentTypeEvent(SiteEquipmentTypeEvent.SITE_EQUIPMENT_TYPE_CREATE, this));
else
updateFromResult(event.result.ROOT["DBO.SITE_EQUIPMENT_TYPE"]);
dispatchEvent(new SiteEquipmentTypeEvent(SiteEquipmentTypeEvent.SITE_EQUIPMENT_TYPE_EDIT, this));
SiteEquipmentType.dispatchEvent(new SiteEquipmentTypeEvent(SiteEquipmentTypeEvent.SITE_EQUIPMENT_TYPE_EDIT, this));
catch(ex:Error)
Alert.show(ex.message, "Error");
updateStatus = UpdateStatus.ERROR;
So the "_all" ArrayCollection serves as a cache of all of the different site equipment types. When the edit window is first opened and a new instance of SiteEquipment is created, the SiteEquipmentType of the current SiteEquipment is added to _all and becomes the only SiteEquipmentType within _all.
At this point, the DropDownList has the correct item selected. The problem occurs when the result comes in from getting all of the SiteEquipmentTypes. The contents of _all are flushed, and each SiteEquipmentType is added in. Once this happens, the DropDownList will have nothing for selectedItem.
I know this is quite complex, but any help would be greatly appreciated.Ok, I have this figured out now. First, though, I'll point out that this worked fine when using MX components and the Halo theme; the problem only appeared after switching over to Spark components and the Spark theme. Anyway, since this class functions as a singleton (as best I understand them), I added a boolean variable to the SiteEquipmentType class representing whether or not the results from the HTTPService call had come back and been inserted into _all. So in the TitleWindow's init method, I only populated the DropDownList's originalValue (which in turn sets the selectedItem) if that variable is true. The first time an instance of the TitleWindow component is opened, though, this variable will initially be false. So back in the SiteEquipmentType class, I have it dispatch an event right after setting the variable to true, and the TitleWindow componet will add a listener for this event if the variable is originally false. If anyone needs further explanation, please ask.
-
Spark DropDownList width does not fit largest item.
In some, but not all cases, when the first item in a Spark DropDownList is not the longest item, when I click on the list to select an item, it resizes to the size of the first item, and thus the other items if selected are truncated.
Is there a workaround?At last, I solved the problem of "determining the longest item" by using the idea mentioned in http://stackoverflow.com/questions/4628368/length-of-a-string-in-pixels.
var format:TextFormat = new TextFormat();
format.font = myDropDownList.getStyle("font-family"); // since we're working with a css file for the styling
format.size = myDropDownList.getStyle("font-size");
Then for each item in the DropDownList's dataprovider determine this width:
textField.text = item.value; // in my case
var width:int = textField.textWidth;
Once you determined the item with the biggest width, set that one as the DropDownList's typicalItem. -
Problem with FTE in DataTips of PlotChart (missing texts)
Hi @all,
we have decided to use the Flex 4.1 and Flash text engine in our projects.
Now I have the following problem with the dataTips: the texts are appearing only partly if datatips of more than one point are showing. The behavior is not regularly.
Here is my code for testing (compiler options: hook at "Use Flash Text engine in MX components":
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
minWidth="955"
minHeight="600"
creationComplete="init()">
<fx:Declarations>
<mx:SolidColor id="sc1" color="#EC6605" alpha=".3"/>
<mx:SolidColorStroke id="s1" color="#EC6605" weight="1"/>
</fx:Declarations>
<fx:Script>
<![CDATA[
import mx.charts.HitData;
import mx.collections.ArrayCollection;
[Bindable]
private var seriesAverageScores:ArrayCollection = new ArrayCollection(new Array());
private static const tipDataString:String = "zeile 1 zeile 1 zeile 1\nzeile 2 zeile 2 zeile 2\nzeile 3 zeile 3 zeile 3\nzeile 4 zeile 4 zeile 4\n -\n -\n -";
private function init():void {
seriesAverageScores.addItem({x: 1, y: 2, dataTip: tipDataString});
seriesAverageScores.addItem({x: 2, y: 2, dataTip: tipDataString});
seriesAverageScores.addItem({x: 3, y: 2, dataTip: tipDataString});
seriesAverageScores.addItem({x: 1.1, y: 2, dataTip: tipDataString});
seriesAverageScores.addItem({x: 2, y: 2, dataTip: tipDataString});
seriesAverageScores.addItem({x: 3, y: 2, dataTip: tipDataString});
seriesAverageScores.addItem({x: 1.05, y: 2, dataTip: tipDataString});
seriesAverageScores.addItem({x: 2, y: 2, dataTip: tipDataString});
seriesAverageScores.addItem({x: 3, y: 2, dataTip: tipDataString});
seriesAverageScores.addItem({x: 0.95, y: 2, dataTip: tipDataString});
seriesAverageScores.addItem({x: 2, y: 2, dataTip: tipDataString});
seriesAverageScores.addItem({x: 3, y: 2, dataTip: tipDataString});
seriesAverageScores.addItem({x: 1.2, y: 2, dataTip: tipDataString});
seriesAverageScores.addItem({x: 2, y: 2, dataTip: tipDataString});
seriesAverageScores.addItem({x: 3, y: 2, dataTip: tipDataString});
seriesAverageScores.addItem({x: 1.15, y: 2, dataTip: tipDataString});
seriesAverageScores.addItem({x: 2, y: 2, dataTip: tipDataString});
seriesAverageScores.addItem({x: 3, y: 2, dataTip: tipDataString});
seriesAverageScores.addItem({x: 1.12, y: 2, dataTip: tipDataString});
seriesAverageScores.addItem({x: 2, y: 2, dataTip: tipDataString});
private function dataTipFunction_average(hd:HitData):String {
var val:String;
var d:Object = hd.item as Object;
return d.dataTip;
]]>
</fx:Script>
<s:VGroup width="100%"
height="100%">
<mx:PlotChart id="myChart1" width="100%" height="100%"
dataTipFunction="dataTipFunction_average" showDataTips="true">
<mx:verticalAxis>
<mx:LinearAxis title="TurnOvers" padding="0.1" minimum="0" maximum="50"/>
</mx:verticalAxis>
<mx:horizontalAxis>
<mx:LinearAxis title="Scores" padding="0.1" minimum="0" maximum="10"/>
</mx:horizontalAxis>
<mx:series>
<mx:PlotSeries dataProvider="{seriesAverageScores}"
name="series 1" fill="{sc1}" stroke="{s1}"
displayName="Average Scores per customer"
xField="x"
yField="y">
</mx:PlotSeries>
</mx:series>
</mx:PlotChart>
</s:VGroup>
</s:Application>
Has anyone an idea how to solve this ?
Thanks, LutzHas noone an idea?
The same problem exists with Legends. For this there was a help from Adobe with a style.
Isn't there a comparable solution for this malfunction? -
Problem with Matrix/Checkbox/Datasource
Hi, i have a problem with a Matrix.
There are 3 Columns on this Matrix, one of those is a Checkbox. I fill the Columns with data, the Checkboxes where just added (no Checkbox is selected), the user has to select the value (Checkbox)he want's to by hand.
After i filled the Matrix i can see all the data on the Form, it's OK, but then i loose all entries after SBO is doing some work. There where shown only the empty rows and the checkboxes.
I guess it has something to do with the databinding. My problem is that i don't have the Data for this form on a db-table. I fill in the matrix the result of some querys. It looks like i need at least a DB-Field for the checkboxes, otherwise there are not working (not selectable)
Somebody knows a solution how i can keep the Data in the Matrix after SBO is doing some work? What could be the reason that i loose the data after filling it in the Matrix? Is there an easy way?
Thanks AndreasAlmost every item on a form need a datasource... If the item reprecents some data in a table the databinding must be a dbds... If the data does not reflect any data in a table (Calulated value, user-decision, ect.) a userdatasource need to be created...
Add a userdatasource
oForm.DataSources.UserDataSources.Add(UID,type,length);
Databind to DBDS
col.DataBind.SetBound(true,TABLE,FIELD);
Databind to UDS
col.DataBind.SetBound(true,,UID); -
Problem with checkbox column in matrix
Hello.
I have a little problem with checkbox column in matrix.
Column is binded to the UserData.
It has ValOn="Y", ValOff="N".
I use C++. It is wird problem. In matrix I have 10 columns - scrollbar role and if You want see checkbox column, You must role to the right. If this column is on the screen, and I use:
checkcell->PutChecked(VARIANT_TRUE);
then the checkbox is cheched, and if the checkbox isn`t on the screen and I use this comment - it nothing happening.
I tried to use ValOn="Y", PutChecked...
The problem i solved if the column is on the screen - if the column is first in matrix or second, but if it`s last I have a big problem.
My column with checkbox is not editable, but I tried to make it editable, check it, and then make it uneditable - the same efect.
How can I solve it ?
Sorry for my english.
Kamil WydraHello Kamil,
I am not sure about your problem, but here is an example of how to use checkbox in UI API.
First, create the matrix with checkbox column in Screen painter, and the output is an xml file, like this. Type as 121 indicates that it is a check box.
- <column AffectsFormMode="0" backcolor="-1" description="" disp_desc="0" editable="0" right_just="0" title="Rented" type="121" uid="Rented" val_off="N" val_on="Y" visible="1" width="41">
<databind alias="U_RENTED" databound="1" table="@VIDS" />
<ExtendedObject />
Second, bind the column to table from DB. This is a bug of 2004 Screen Painter, so if you are using 2005 Screen Painter, there is no problem.
Third, when you open the form, you can check and uncheck the cell.
BTW, please set the editable of the column to true.
Hope this helps,
Nick -
Stacked 100% bar chart - Problem with datatips for zero value data points
I have a stacked 100% bar chart that shows datatips in Flex 4. However, I don't want it to show datatips for
data points with zero values. Flex 4 shows the datatip for a zero value data point on the left side of a bar if the data point is not the first in the series.
Here's the code that illustrates this problem. Of particular concern is the July bar. Because of the zero value data point problem, it's not possible to see the datatip for "aaa".
Any ideas on how we can hide/remove the datatips for zero value data points ? Thanks.
<?xml version="1.0"?>
<s:Application
xmlns:fx="
http://ns.adobe.com/mxml/2009"xmlns:mx="
library://ns.adobe.com/flex/mx"xmlns:s="
library://ns.adobe.com/flex/spark"creationComplete="initApp()"
height="
1050" width="600">
<s:layout>
<s:VerticalLayout/>
</s:layout>
<fx:Script><![CDATA[
import mx.collections.ArrayCollection;[
Bindable]
private var yearlyData:ArrayCollection = new ArrayCollection([{month:
"Aug", a:1, b:10, c:1, d:10, e:0},{month:
"July", a:1, b:10, c:10, d:10, e:0},{month:
"June", a:10, b:10, c:10, d:10, e:0},{month:
"May", a:10, b:10, c:10, d:0, e:10},{month:
"April", a:10, b:10, c:0, d:10, e:10},{month:
"March", a:10, b:0, c:10, d:10, e:10},{month:
"February", a:0, b:10, c:10, d:10, e:10},{month:
"January", a:10, b:10, c:10, d:10, e:10}]);
private function initApp():void {}
]]>
</fx:Script>
<s:Panel title="Stacked Bar Chart - Problems with DataTips for Zero Value Items" id="panel1">
<s:layout>
<s:HorizontalLayout/>
</s:layout>
<mx:BarChart id="myChart" type="stacked"dataProvider="
{yearlyData}" showDataTips="true">
<mx:verticalAxis>
<mx:CategoryAxis categoryField="month"/>
</mx:verticalAxis>
<mx:series>
<mx:BarSeries
xField="a"displayName="
aaa"/>
<mx:BarSeries
xField="b"displayName="
bbb"/>
<mx:BarSeries
xField="c"displayName="
ccc"/>
<mx:BarSeries
xField="d"displayName="
ddd"/>
<mx:BarSeries
xField="e"displayName="
eee"/>
</mx:series>
</mx:BarChart>
<mx:Legend dataProvider="{myChart}"/>
</s:Panel>
<s:RichText width="700">
<s:br></s:br>
<s:p fontWeight="bold">The problem:</s:p>
<s:p>Datatips for zero value data points appear on left side of bar (if data point is not the first point in series).</s:p>
<s:br></s:br>
<s:p fontWeight="bold">For example:</s:p>
<s:p>1) For "June", eee = 0, mouse over the left side of the bar to see a datatip for "eee". Not good.</s:p>
<s:br></s:br>
<s:p>2) For "July", eee = 0 and aaa = 1, can't see the datatip for "aaa", instead "eee" shows. Real bad.</s:p>
<s:br></s:br>
<s:p>3) For "Feb", aaa = 0, datatip for "aaa" (first point) does not show. This is good.</s:p>
<s:br></s:br>
<s:p>4) For "Mar", bbb = 0, datatip for "bbb" shows on the left side of the bar. Not good.</s:p>
<s:br></s:br>
<s:p fontWeight="bold">Challenge:</s:p>
<s:p>How can we hide/remove datatips for zero value data points?</s:p>
<s:br></s:br>
</s:RichText></s:Application>FYI.
Still have the issue after upgrading to the latest Flex Builder 4.0.1 with SDK 4.1.0 build 16076.
Posted this as a bug in the Adobe Flex Bug and Issue Management system. JIRA
http://bugs.adobe.com/jira/browse/FLEXDMV-2478
Which is a clone of a similar issue with Flex 3 ...
http://bugs.adobe.com/jira/browse/FLEXDMV-1984 -
Problem with a description in a LOV
Hi, I have a problem with a Lov.
I have a LOV with a id and a description link with this id.
When this field is blank I need to search and i push the lov. But when i save and i go back then i can't show the description.
If a put this Field as a dropDownList I don't have any problem, I can show the description.
But with LOV I can only show the id, not the description. Then I need search the description with the pop up of the lov
I'm novate in adf, so any help It could be important for me.
Thank you.maybe these will help shed some light on the problem:
http://java.sun.com/developer/qow/archive/76/
http://forums.devshed.com/archive/t-126626
http://www.javaworld.com/javaworld/javatips/jw-javatip49.html
Just a simple Google search popped these up. I hope they help.
-JBoeing -
Problem with rerendering h:panelGrid with rendered attribute
Hi,
I am new to jsf and trying to learn its features as I find it easy and fast for development purpose.I have been developing with jsf for past few weeks and got myself stuck with a problem, tired of which I had to take the forum's help :). My problem is that I need to show/hide h:panelGrid using any of the options below:
I tried putting the grid in the div and show/hide that div using javascript..works fine but the problem with this is, even when the div is hidden the components (h:inputText ) within the grid are submitted with the form, which should not be the case since its hidden (as with normal jsps).
I worked around with rendered attribute of the grid, and show/hide this grid using the backing bean method which is actually a valueChangeListener of h:selectOneMenu and set the boolean for the rendered to true/false as required, the grid is hide/shown correctly, but this isn't giving me any solution because when I submit the form with this grid shown on the view, its components values are still not submitted :( I dont know whats the reason behind this or what clue am I missing here. I dont know why when the grid is shown correclty, its components values are not submitted.. hence not validated too..
Any help will be highly appreciable.
Regards
srehman>
gimbal2 wrote:
No, in "normal jsps" you'll get the same thing - even though you
visibly hide a component, it is still there and thus will still be part
of a form submit. If you don't want form fields to submit, you'll have
to make sure they are physically not there, or the fields are disabled.Well thanks alot for correcting me on this mate.
Don't know either, it should work if you did everything correctly. Are
you sure the databinding (to a JSF backing bean field) of the grid is
correct? When you create a similar setup but without any of the
show/hide logic, does it work then?I guess I have done it correctly but let me tell you, I have no direct binding to the grid itself, instead I have h:inputText fields in the grid that are bound to the backing bean's properties, which I need to submit and validate too. e.g{color:#800000}<h:panelGrid id="myPanel" columns="3" rendered="Bean.renderStatus">
<h:outputText value="variable"/>
<h:inputText id="v" value="Bean.property" required="true">
<a4j:support ......... />
</h:inputText>
</h:panelGrid>{color}
{color:#800000}<rich:message for="v"/>{color}
Here I am able to hide and show the grid but I am unable to submit the field in any case whether its hidden or shown :( At first the grid is hidden and then on the valueChangeListener of h:selectOneMenu rendered value is set to either true or false.( renderStatus is set in the value change listener ).
And yeah without this logic of hide/show its working fine with me. Any guess or idea what am I doing wrong here.
Thanks for your time by the way.
Regards,
Shoaib
Maybe you are looking for
-
Making the move to 16:9, but totally confused about what settings to use!
Hi, It seems to me that since all new TV's being sold are wide-screen, it is time for me to stop making videos in 4:3. But I am completely stumped by the procedure to work in 16:9. I have shot my footage in standard definition, 16:9. The final produc
-
Hi, I wrote a 10-pages guide regarding Exchange P2V process which I performs often at organiziations. I would like to hear your opinion about this guide, if you have additional information - feel free to contact me at netanel [at] ben-shushan [dot] n
-
Sound Output Volume Preference won't stick in newly reinstalled 10.6.8.
I recently re-installed OS 10.6.8 (from the retail Snow Leopard Install DVD, followed by the 10.6.8 Combo Updater) to my 2006 iMac (version 6.1) 24". Ever since, whenever I re-boot, the output volume of the internal speakers is set to a reduced level
-
How to reduce size of other space bar of flash storage on Macbook Pro?
Hi, I am a new customer to the Macbook Pro world. While it is a great computer I have noticed that my storage space is becoming limited. Of 250GB flash storage, 137GB of this is classified as 'Other'. Can someone please advise on what this consists o
-
I've got a problem, and one solution from Verizon is to try chat. EVERY TIME I've tried I was told that chat is not available. Now, maybe my time selection is bad, but geez, it's 10 am and it's not available. Anyone ever gotten through on chat? W