Actionscript in a Custom Component
Can anyone tell me if you can put actionscript inside of a
custom component? It throws errors anytime I try to do it.
I have a horizontallist component that is being populated
with an itemrenderer which holds an image component. The
horizontallist takes fifteen images and loads them into the
itemrenderers, creating a scrollable image slideshow.
I am trying to get it to check to see if the image loaded
successfully, and if not, either set the visibility of that image
component to false, or remove it.
Here is the code for the horizontallist:
<mx:HorizontalList
id="imageBar"
itemRenderer="listingImage"
height="330"
width="925"
paddingLeft="5"
paddingRight="5"
rollOverColor="#FFFFFF"
selectionColor="#FFFFFF"
>
And the code for the custom component.....
<mx:Canvas
xmlns:mx="
http://www.adobe.com/2006/mxml"
height="320"
width="400"
verticalScrollPolicy="off"
horizontalScrollPolicy="off"
>
<mx:Image
source="
http://www.urladdress.com/idx/rmls/images/resimages/{data.id}_{data.imageNum}.jpg"
height="300" scaleContent="true"
/>
</mx:Canvas>
I'm pretty new to Flex, so any help would be great!
just insert the script tags in the custom component and place
your actionscript within those script tags. So in your case just
insert the following script tags above the image control...
<mx:Script>
<![CDATA[
// actionscript goes here
]]>
</mx:Script>
- Tony
Similar Messages
-
EncodeBegin and encodeEnd, or getChildren.add in a custom component?
which is considered a better practice in JSF custom composite components?
just insert the script tags in the custom component and place
your actionscript within those script tags. So in your case just
insert the following script tags above the image control...
<mx:Script>
<![CDATA[
// actionscript goes here
]]>
</mx:Script>
- Tony -
Including .as files in a custom component
Can anyone tell me how to include an actionscript file in a
custom component when the .as file resides one level above the
component?
All of my custom components are in the "src/components"
directory and the actionscript file I need to include is one level
up in the "src" directory. I assume this can be done easily, but I
am new to Flex and can't get it working. I have tried ../ ,
parentDocument, parentApplication, Application.application, and
fully referencing the file from C: with no luck.
The ../ version seems to point to the right place but my
Problems panel is showing
"1068: Unable to open included file:
C:\CFusionMX7\wwwroot\c21hp\flex\src\yahooMap2.as"
Any help would be greatly appreciated.@Ryan:
Thanks for your reply. For type property in Inspectable metadata tag: http://livedocs.adobe.com/flex/gumbo/html/WS2db454920e96a9e51e63e3d11c0bf680e1-7ffe.html#W S2db454920e96a9e51e63e3d11c0bf69084-7a21
It can have values like Boolean, Array, String etc. I am trying to have a custom one. But I notice that I have to close the property tag, even if it is a string or html for e.g. text property in TextInput, I have to write something like this:
<mx:TextInput>
<mx:htmlText>
<![CDATA[
]]>
</mx:htmlText>
</mx:TextInput>
and
<mx:TextInput>
<mx:text>something</mx:text>
</mx:TextInput>
But I still think, it should be there. Not sure
Chetan -
Flex Print Job not working with custom component
Hi All,
I have to print pages with header, body and footer. So the thought process was to create a custom component fro header, footer and body. Header component is based on Box, Body is a renderer (which will have fix value of items - and will decide the number of possible pages) and footer is again based on Box.
But when i created a simple Custom component like this for header
<?xml version="1.0" encoding="utf-8"?>
<mx:VBox xmlns:fx=http://ns.adobe.com/mxml/2009
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx">
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
<mx:HBox> <mx:Label id="testLabel" text="Test Container"/>
</mx:HBox>
</mx:VBox>
Then when i try to add this to FlexPrintJob, and save it as 'xps' to see the print output, i get error message that this file is in use or damaged.
var myPrintJob:FlexPrintJob = new FlexPrintJob();
if(!myPrintJob.start()){
return;
var header:Header = new Header();
header.width = myPrintJob.pageWidth;
header.visible = false;
FlexGlobals.topLevelApplication.addChild(panierPrintHeader);
myPrintJob.addObject(header);
myPrintJob.send();
FlexGlobals.topLevelApplication.removeChild(panierPrintHeader);
But this does not work and i get the above mentioned exception. Now when i not use the custom component and just have a label or HBox or anything on stage before the print functionality is invoked, it works fine. And this too haapens only if you have a mxml component, i tried by creating a new Label component using actionscript and then provide the same to the printJob, which did not work either. I need help on this, else i will have to take print functionality to server side(Java) which has some business implications, the reason why i am spending time on flex for printing.
Thanks and Regards,
Jigar
Looks like custom component print is not working fine with flex or i am doing something terribly wrong.
Looking forward for help.Is there nobody in flex community who can help on this....
Looks like a toothless class that adobe actionscript team has provided, which is not liked across much -
Help with creating a custom component.
Hi. I have created a really simple custom component called
myComp. It is a simple Canvas 100 pixels x 100 pixels with an Image
control component.
<mx:Canvas>
<mx:Image id="image1">
</mx:Canvas>
After instantiating the component in Main.mxml eg. var
pic1:myComp = new myComp(); I am having a problem setting the
source property of the Image component.
"image1" is the id of mx:Image in the custom compoenent so I
tried pic1.image1.source = "assets/ball.jpg" but I get a run time
error "Error #1009: Cannot access a property or method of a null
object reference".
Don't really know what I am doing wrong.
Any help please!In your custom component, try adding a bindable public var
which contains the path to your image. Also, set the image.source
to this var.
In your main app, set the var within the <mx:> tags of
the custom component. Since it is a public var, it will show up in
the code hint. You can also now change the image var from the main
app anytime you like using ActionScript code. -
Custom component property value handling at run time
I would like to develop simple custom component which has three properties PROP1, PROP2 & RESULT . These parameters are bound to excel sheet cells as follows..
cell A1 connected to PROP1
cell A2 connected to PROP2 and
cell A3 connected to RESULT.
In excel A1 cell has excel formula set as =IF(A2<5,10,0).
Custom component would be simple button display at runtime and on click of the same, I would like to perform following actions in sequence with N number of times.
1. First push any random number to PROP2. (which is simple task, I believe)
2. Pick new value of PROP1 which is changed due to existance of excel formula (+ using dispatchevent I could able to pass value to excel cell A2. But not able to read new value of PROP1+)
3. check new PROP1 value equal to 10. If it is 10 then count it otherwise again push new random value to PROP2.
4. Continue step 1 to 3 till N number of times. and finally
4. Push number of counts for PROP1 value 10 to RESULT parameter.
All the parameters are bindable (getter/setter with [Bindable]) in Flex component application and flex propertysheet application use binding ID to bind with cell address. with binding direction BOTH and SINGLETON
Here is flex function code which triggered at button click.
public function test002():void {
while ( N < 100)
this.PROP2 = Math.round(Math.random()*1000);
dispatchEvent(new PropertyChangeEvent(PropertyChangeEvent.PROPERTY_CHANGE, false, false, PropertyChangeEventKind.UPDATE, "PROP2", null, PROP2, this));
if (this.PROP1 == 10)
cnt++;
this.RESULT = cnt;
My observations are as follows.
- new push of value to PROP2 get reflected to excel A2 when button click event is over, not at the time of while loop process execution.
- Also I observed PROP1 value never changes and it is the value which is recorded just before button click event of component at run time and remain the same till button click event is over.
- Further to this I notice as click event is over, new value of PROP2 reflected in cell A2 and change value (if it passes IF formula of excel ) in A1 as well. Next button click action takes these new A1 and A2 values in consideration and process the function "test002".
I would like to understand possibility of custom component event execution process, which can able to pass as well as read value from component parameters to underlying excel with changes due to excel formula existance. If it is not limitations (If so) what is the set of commands which can be helpful to achieve this. I appreciate if anybody explain typical event execution required in such scenarios with some actionscript code directions.
Thanks
Sandesh
Edited by: Sandesh Darne on Feb 8, 2010 11:48 AM
Edited by: Sandesh Darne on Feb 10, 2010 5:23 AMMarton,
I have tried your solution. It works well immediately after xcelsius dashboard get displayed or preview. It does not wait click event to happen. So I modified further by adding one switch ( "switch001" in code piece shown below) to control iteration by click event. That stops running of iteration immediate after dashboard display.
In order to see iteration I have to click twice on button. First click does send "frm" parameter value to excel and excel formula operates. The excel formula result send back to component via SETTER of "frmResult" . But it stops over there. If I click second time the iteration starts for 100 times.
Also I try to export this to PDF. PDF file get generated. If I try to open PDF file it raise error.
My code is attached here.
"frm" is the parameter that sends random number to excel.
"frmResult" parameter receives excel formula output and send it back to component.
"test()" function operate on button click event and set switch001 and then calls "Calc" function for iterations.
MXML code..........
<mx:VBox>
<mx:TextInput id="frmResultLabel" width="100" />
<mx:Button label="test..." click="test()"/>
</mx:VBox>
Actionscript code
public var cnt:int;
public var N:int = 0;
public var sum:int = 0;
public var switch001:Boolean = false;
public function test():void {
N = 0;
sum = 0;
switch001 = true;
public function Calc():void {
if (switch001 == true)
if (N < 100)
this.frm = Math.round(Math.random() * 1000);
else if (N == 100) // return the result
this.frmResult = sum;
// Label component use to display frm and frmResult values at runtime
frmResultLabel.text = sum.toString() + ">" + this.frm + ">" + this.frmResult;
N++;
[Bindable]
private var _frm:int;
private var _frmChanged:Boolean = true;
[Bindable]
public function get frm():int
return _frm;
public function set frm(value:int):void
//if (value == null) value = 0;
if (_frm != value)
_frm = value;
_frmChanged = true;
invalidateProperties();
override protected function commitProperties():void
super.commitProperties();
if (_frmResultChanged == true)
// start the cycle again by generating a new random number,
// or write out the result
Calc(); -
Passing a reference / variable to a Custom Component
Hi, I was wondering if someone could help me.
It seems like a very simple problem but I cant for the life
of me seem to work out a solution.
I have created a Custom Component that extends from the
UIComponent that consists of a “rev counter” style
clock face etc….
I want to use this component multiple times within my
application – however feed it different data so for example
each “rev counter” on the page will be displaying
different data etc…..
I want to be able to reuse my component and not have to
create a new component every time I add a “rev counter”
to my application, therefore I need some way of passing a reference
/ variable to the component (maybe from the <mx /> tag where
I declare it in the MXML code ??? )
<mx:Application ….
xmlns:comps="components.*" …..>
<comps:RevCounterComp id=”” (add something
here to reference???) />
</ mx:Application>
Doing this will allow me to reuse my ONE custom component
MANY times feeding it different data (different data provaiders for
each instance of the single component)
Hope this makes sense???
Any help / advice is much appreciated,
Thanks,
Jon.Jon,
jmryan's suggestion is the preferred way to go. This way you
can use the simple MXML syntax that you described in your post.
If your custom component is defined in ActionScript, you can
use setters or the creationComplete event to update the component
when the values are passed in from the tag (they are set *after*
your constructor runs).
Even easier, if your component is defined in MXML, you can
add [Bindable] to your public field and then bind directly to it in
the custom component's MXML code.
- Peter -
Can I define a constructor for a Custom Component?
I have a custom component which I instantiate through ActionScript. For the sake of clean code, I would like to be able to assign the variables through the constructor like any other class:
var myComp:CustomComponent = new CustomComponent(arg1, arg2, ...);
However, when I try to write a constructor in the Script block for the component, it gives me a compile error telling me that I have multiple constructors:
//In Script tag//
public function CustomeComponent(arg1, arg2 ...):void { ... }
Are we not able to define constructors for Custom Components?If this post helps, please mark it as such.
If you create an array variable in your MXML component, and then set it with myVar="[val1, val2, val3]" in the opening tag of your component, then you basically have a constructor in MXML.
You can use the [Bindable] metadata tag in three places:
Before a public class definition.
The [Bindable] metadata tag makes usable as the source of a binding expression all public properties that you defined as variables, and all public properties that are defined by using both a setter and a getter method. In this case, [Bindable] takes no parameters, as the following example shows:
[Bindable]
public class TextAreaFontControl extends TextArea {}
The Flex compiler automatically generates an event named propertyChange, of type PropertyChangeEvent, for all public properties so that the properties can be used as the source of a data binding expression.
If the property value remains the same on a write, Flex does not dispatch the event or update the property, where not the same translates to the following test:
(oldValue !== value)
That means if a property contains a reference to an object, and that reference is modified to reference a different but equivalent object, the binding is triggered. If the property is not modified, but the object that it points to changes internally, the binding is not triggered.
Note: When you use the [Bindable] metadata tag before a public class definition, it only applies to public properties; it does not apply to private or protected properties, or to properties defined in any other namespace. You must insert the [Bindable] metadata tag before a nonpublic property to make it usable as the source for a data binding expression.
Before a public, protected, or private property defined as a variable to make that specific property support binding.
The tag can have the following forms:
[Bindable]
public var foo:String;
The Flex compiler automatically generates an event named propertyChange, of type PropertyChangeEvent, for the property. If the property value remains the same on a write, Flex does not dispatch the event or update the property.
You can also specify the event name, as the following example shows:
[Bindable(event="fooChanged")]
public var foo:String;
In this case, you are responsible for generating and dispatching the event, typically as part of some other method of your class. You can specify a [Bindable] tag that includes the event specification if you want to name the event, even when you already specified the [Bindable] tag at the class level.
Before a public, protected, or private property defined by a getter or setter method.
You must define both a setter and a getter method to use the [Bindable] tag with the property. If you define just a setter method, you create a write-only property that you cannot use as the source of a data-binding expression. If you define just a getter method, you create a read-only property that you can use as the source of a data-binding expression without inserting the [Bindable] metadata tag. This is similar to the way that you can use a variable, defined by using the const keyword, as the source for a data binding expression.
The tag can have the following forms:
As far as binding, you can add the [Bindable] tag before the class declaration to make bindable all public properties defined as variables, and all public properties defined by using both a setter and a getter method. -
Creating a custom component is causing a strange scoping issue
I am a fairly new user to Flash and Actionscript, but I have
a fair amount of experience working with C and Java. I'm currently
working with Actionscript 2 in Macromedia Studio 8. I was trying to
create a new component for a project I am working on, and I
followed the tutorial in the help and all testing works while I am
in context of the flash document where I export the component from.
However, I try testing my component in a new blank document and I
get some strange behavior.
I am able to create a component on the stage, and adjust the
properties perfectly fine. However, when I test the file, the
variables for colors go out of scope. That is, the adjustments I
made to the component through the parameters panel, and saw updated
on the stage aren't demonstrated at runtime. The Number variable I
used however is preserved. I did some traces, and it appears that
this is happening because at runtime in the new blank document, the
variables in the onEnterFrame method go out of scope, where they
weren't before.
It seems really strange to me that I should be able to edit
the color on stage but have it revert while it is running. My
intuition says that if it wasn't going to work in the new document,
that it shouldn't work in either case.
Anyway, here is the code for the .as file, I hope I'm just
doing something stupid.There seems to be a little confusion here. Think of it this way:
A basic UIComponent by itself is not visible; you can add something you can see to it to make a visual custom component. For example, a ComboBox component is a UIComponent with a ComboBox added to it.
The UIComponent is the lightest weight component available from which you can create other components. I use it as the base for custom components that the user cannot see, like a data manager.
HTH,
Carlos -
Passing arguments to a custom component in the constructor
I would like to know if it is possible to pass arguments to a
custom component in the constructor when I'm instantiating it
within Actionscript. I've not seen anyone do this, so at the moment
I have a couple of public properties defined on the custom
component and then do the following:
var myComponent:TestComponent = new TestComponent();
myComponent.propertyOne = true;
myComponent.propertyTwo = 12;
etc.
Whereas I'd like to do something like:
var myComponent:TestComponent = new TestComponent( true, 12
Any ideas if this is possible?Another approach as opposed to creating init function is to link symbol with autogenerated class (just assign it a class but do not create *.as file for it) and use it just as graphical view with no functionality (well only MovieClip's functionality).
ViewClip.as
public class ViewClip extends MovieClip {
public var view:MovieClip;
public function ViewClip(){
this.view = instantiateView();
this.addChild(view);
protected function instantiateView():MovieClip {
return new MovieClip();
Circle.as
public class Circle extends ViewClip {
public function Circle(scaleX:Number, scaleY:Number) {
super();
override protected function instantiateView():MovieClip {
return new ClassView(); -
Instantiating a Custom Component
I am somewhat new to this concept and I keep thinking about
things the ActionScript 2 way where we can say:
createObject(refObject,instanceName,depth,constructorObject);
I am instantiating custom MXML components using a technique
similar to the following:
var classRef:Class =
flash.utils.getDefinitionByName("Components."+module) as Class;
var d:DisplayObject = new classRef() as DisplayObject;
mainCanvas.addChild(d);
where mainCanvas is a Canvas component on my main stage and d
is a reference to the custom component attached to the mainCanvas.
My question is what is the best practice means to pass data
to d such that it will be available upon instantiation. I am
looking to employ the constructor object concept from attachMovie
and createObject of AS 2.
Thanks in advanceLook up ClassFactory - but what you are doing isn't very
Flex-ish. The better way is to do:
var d:Whatever = new Whatever();
d.property1 = value;
d.property2 = value;
mainCanvas.addChild(d);
This is the way we do it within the Flex framework and is
pretty easy to understand. You might also want to look up the
commitProperties function and override that in your custom
component in case you need to combine or use your property values
while your component is initializing. -
Mxml elements inside custom component
Hi all, i'm a flex newbie but i know AS3, i've encountered a problem during the development of a custom component: my custom component is a panel with some buttons, but i want that anyone can insert mxml elements (especially form elements) inside this panel in this way:
ActionScript Code:
<custom:myDialogBox >
<mx:Form ...>
<mx:TextInput ...>
</custom:myDialogBox>
So i created myDialogBox component:
ActionScript Code:
<mx:Panel xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:Metadata>
[DefaultProperty("hboxFirstLine")]
</mx:Metadata>
<mx:Script>
<![CDATA[
import mx.containers.HBox;
import mx.containers.Panel;
import mx.controls.Button;
import mx.controls.Text;
import mx.core.UIComponent;
]]>
</mx:Script>
<mx:HBox id="hboxFirstLine" width="100%">
</mx:HBox>
<mx:HBox id="hboxSecondLine" width="100%" horizontalAlign="center">
<mx:Button label="Conferma" />
<mx:Button label="Annulla" />
</mx:HBox>
<mx:ControlBar id="controllBar" horizontalAlign="right">
<mx:Label id="alertFooter" text="sFooter" />
</mx:ControlBar>
</mx:Panel>
I expect that the form goes inside hboxFirstLine... but instead i get this error:
Error: In initializer for 'hboxFirstLine': type mx.controls.Form is not assignable to target type mx.containers.HBox.
Any idea?hboxFirstLine has to be a Form, not an HBox.
Also, if that is all the code of your component, you don't need import statements.
HTH. -
Problem with inputText in my custom component
Hi, I have a custom dataTable component that I'm trying to get to work. It has to be a custom component because dataTable doesn't support rowspan, colspan, multi line headers, and a rendered attribute for rows. The problem is, that when I wrap the column tag inside my row tag then the method for the inputText tag never gets called in the UPDATE_MODEL_VALUES phase.
I'm starting to think that JSF doesn't support 2 levels of tags between the inputText and dataTable. I'm hoping that someone can tell me what I have wrong with my components.
Here is the JSP snippet.
<cjsf:rptTable>
<cjsf:data id="dataTable1" value="#{allAuthUser.tableRows}" var="myTableRow1">
<cjsf:row>
<cjsf:col>
<h:inputText id="tableTestFld" value="#{myTableRow1.testFld}" size="5" maxlength="5"/>
</cjsf:col>
</cjsf:row>
</cjsf:data>
</cjsf:rptTable>Here is what it renders. It looks to me like everything renders fine. So I'm guessing that there is something in a component that is causing JSF during the life cycle to not be able to process correctly.
<table>
<tbody>
<tr>
<td><input id="tblmaintForm:body:dataTable1_0:tableTestFld" name="tblmaintForm:body:dataTable1_0:tableTestFld" type="text" value="" maxlength="5" size="5"/></td>
</tr>
<tr>
<td><input id="tblmaintForm:body:dataTable1_1:tableTestFld" name="tblmaintForm:body:dataTable1_1:tableTestFld" type="text" value="" maxlength="5" size="5"/></td>
</tr>
<tr>
<td><input id="tblmaintForm:body:dataTable1_2:tableTestFld" name="tblmaintForm:body:dataTable1_2:tableTestFld" type="text" value="" maxlength="5" size="5"/></td>
</tr>
</tbody>
</table>Note: If I leave off the row tag it renders the same way except of course the <tr> and </tr> tags are missing. If I do this, then the backing method for the inputText tag is called and everything works fine. Why doesn't it work with the row tag in place?
Here are the components:
public class UIRptTable extends UIComponentBase {
public UIRptTable() {
setRendererType("tblmaint.rptTableRenderer");
public String getFamily() {
return "javax.faces.Output";
public class UIRptTableData extends HtmlDataTable {
public UIRptTableData() {
setRendererType("tblmaint.rptTableDataRenderer");
public String getFamily() {
return "javax.faces.Data";
public class UIRptTableRow extends UIOutput {
public UIRptTableRow() {
setRendererType("tblmaint.rptTableRowRenderer");
public String getFamily() {
return "javax.faces.Output";
public class UIRptTableCol extends UIColumn {
public UIRptTableCol() {
setRendererType("tblmaint.rptTableColRenderer");
public String getFamily() {
return "javax.faces.Column";
}Here is part of the faces-config file in case you need it.
<!-- Components -->
<component>
<component-type>tblmaint.rptTable</component-type>
<component-class>com.monsanto.ag_it.fieldops.aim.tblmaint.component.UIRptTable</component-class>
</component>
<component>
<component-type>tblmaint.rptTableData</component-type>
<component-class>com.monsanto.ag_it.fieldops.aim.tblmaint.component.UIRptTableData</component-class>
</component>
<component>
<component-type>tblmaint.rptTableRow</component-type>
<component-class>com.monsanto.ag_it.fieldops.aim.tblmaint.component.UIRptTableRow</component-class>
</component>
<component>
<component-type>tblmaint.rptTableCol</component-type>
<component-class>com.monsanto.ag_it.fieldops.aim.tblmaint.component.UIRptTableCol</component-class>
</component>
<!-- Render Kits -->
<render-kit>
<renderer>
<component-family>javax.faces.Output</component-family>
<renderer-type>tblmaint.rptTableRenderer</renderer-type>
<renderer-class>com.monsanto.ag_it.fieldops.aim.tblmaint.renderer.RptTableRenderer</renderer-class>
</renderer>
</render-kit>
<render-kit>
<renderer>
<component-family>javax.faces.Data</component-family>
<renderer-type>tblmaint.rptTableDataRenderer</renderer-type>
<renderer-class>com.monsanto.ag_it.fieldops.aim.tblmaint.renderer.RptTableDataRenderer</renderer-class>
</renderer>
</render-kit>
<render-kit>
<renderer>
<component-family>javax.faces.Output</component-family>
<renderer-type>tblmaint.rptTableRowRenderer</renderer-type>
<renderer-class>com.monsanto.ag_it.fieldops.aim.tblmaint.renderer.RptTableRowRenderer</renderer-class>
</renderer>
</render-kit>
<render-kit>
<renderer>
<component-family>javax.faces.Column</component-family>
<renderer-type>tblmaint.rptTableColRenderer</renderer-type>
<renderer-class>com.monsanto.ag_it.fieldops.aim.tblmaint.renderer.RptTableColRenderer</renderer-class>
</renderer>
</render-kit>I sure hope that someone can help me out. Please let me know if you need any additional information.
Thanks,
RayHi, Ray!
1) I was trying to put a button in the column header (for sorting) and I couldn't get that to work. That involved the >colhdr tag. I got that to work but I don't remember the fix. I'll look it up and reply back with that when I can.Dealing the first part of your trouble, you need NOT a custom component.
I have looked through the implementation of RepeaterRenderer, as you advised me, and found that the multi-header possibility is included in the implementation of dataTable control.
The code below is the part of source of repeater.jsp with only change:
<d:data_repeater>  <h:dataTable>
And it works fine.
<h:dataTable id="table"
binding="#{RepeaterBean.data}"
rows="5"
value="#{RepeaterBean.customers}"
var="customer">
<f:facet name="header">
<h:outputText value="Customer List"/> <!� First Header row -- >
</f:facet>
<h:column>
<%-- Visible checkbox for selection --%>
<h:selectBooleanCheckbox
id="checked"
binding="#{RepeaterBean.checked}"/>
<%-- Invisible checkbox for "created" flag --%>
<h:selectBooleanCheckbox
id="created"
binding="#{RepeaterBean.created}"
rendered="false"/>
</h:column>
<h:column>
<f:facet name="header">
<h:outputText value="Account Id"/> <!�Second Header row -- >
</f:facet>
<h:inputText id="accountId"
binding="#{RepeaterBean.accountId}"
required="true"
size="6"
value="#{customer.accountId}">
</h:inputText>
<h:message for="accountId"/>
</h:column>
<h:column>
<f:facet name="header">
<h:outputText value="Customer Name"/> <!�Second Header row -- >
</f:facet>
<h:inputText id="name"
required="true"
size="50"
value="#{customer.name}">
</h:inputText>
<h:message for="name"/>
</h:column>
<h:column>
<f:facet name="header"> <!�Second Header row -- >
<h:outputText value="Symbol"/>
</f:facet>
<h:inputText id="symbol"
required="true"
size="6"
value="#{customer.symbol}">
<f:validateLength
maximum="6"
minimum="2"/>
</h:inputText>
<h:message for="symbol"/>
</h:column>
<h:column>
<f:facet name="header"> <!�Second Header row -- >
<h:outputText value="Total Sales"/>
</f:facet>
<h:outputText id="totalSales"
value="#{customer.totalSales}">
<f:convertNumber
type="currency"/>
</h:outputText>
</h:column>
<h:column>
<f:facet name="header"> <!�Second Header row -- >
<h:outputText value="Commands"/>
</f:facet>
<h:commandButton id="press"
action="#{RepeaterBean.press}"
immediate="true"
value="#{RepeaterBean.pressLabel}"
type="SUBMIT"/>
<h:commandLink id="click"
action="#{RepeaterBean.click}"
immediate="true">
<h:outputText
value="Click"/>
</h:commandLink>
</h:column>
</h:dataTable>
You may have a look at HTML source to prove that dataTable is already what you need:
<table id="myform:table">
<thead>
<tr><th colspan="6" scope="colgroup">Customer List</th></tr>
<tr>
<th scope="col"></th>
<th scope="col">Account Id</th>
<th scope="col">Customer Name</th>
<th scope="col">Symbol</th>
<th scope="col">Total Sales</th>
<th scope="col">Commands</th>
</tr>
</thead>
<tbody>
2.) The second trouble is still unsettled as previously. Right now I have different task at my job, and I can�t continue investigation of this problem.
But when you find smth., please let me know. I�ll be very grateful.
Regards,
Oleksa Stelmakh -
Unable to Edit the View in Custom Component
Hi Experts,
Please help me to resolve this issue !
I am unable to lock the BOL Entity in my custom component using BTAdminH. I have written the below code in the Edit event Handler for Edit Button. The lr_entity->lock( ) condition statement is getting false and it is skipping the "set_view_editable( me )." code statement. Why??
This is code excerpt that I have taken from edit button of the BP_HEAD/AccountViewSet and altered to my component/View
DATA: lr_entity TYPE REF TO cl_crm_bol_entity,
lr_controller TYPE REF TO cl_ZVKH8_bspwdcomponent_impl.
TRY.
lr_controller ?= me->comp_controller.
lr_entity ?= lr_controller->typed_context->btadminh->collection_wrapper->get_current( ).
IF lr_entity IS BOUND.
IF lr_entity->IS_LOCKED EQ abap_false.
IF le_entity->IS_CHANGEABLE EQ abap_true.
IF lr_entity->lock( ) EQ abap_true.
me->view_group_context->set_view_editable( me ).
ENDIF.
ENDIF.
ENDIF.
ENDIF.
and when I directly executed the below code in the Edit event Handler for Edit Button I am receiving the dereferencing NULL value exception. Why in my custom component in many places this happening??
me->view_group_context->set_view_editable( me ).
Exception Details
CX_SY_REF_IS_INITIAL - Dereferencing of the NULL reference
Method: ZL_ZVKH8_DETAILSEF_IMPL=>EH_ONBACK
Thanks,
BujjiHi Summit & NishaNC,
Thanks for your responses !
As suggested, I have debugged the code for ->lock( ) method and there are exceptions raised from some methods.
Method GET_LOCK () -> Method GET_ROOT () ->Method GET_PARENT ()
At GET_ROOT( ) method i have received an exception
"Root entity BTAdminH could not be determined" and one more "Entity BTAdminH could not be locked"
Later when I have checked in MODEL Browser, I found that the BOL object "BTAdminH" for my view is an Access object and not the Root Object.
Hence, I have a question? Does the locking can be done only for ROOT Objects?
If this is TRUE then I think this is the major problem with my custom component where even the cross component navigation is also not happening and in many places I am receiving "Dereferencing NULL Value" information.
Also I have gone through some of the Threads and one information that I found from Sumit Mittal
1. An access object is an independent entity, has primary keys of its own.
2. A root object is a special access object that is at the top of the hierarchy based on business rules.
3. A dependent object's primary keys are supplied by access objects and it's lifetime is bound to them. If the parent object is destroyed, the dependent object is also destroyed.
4. Search objects are query objects useful for querying root objects
5. Search result objects - Search objects return the results in the form of a result object together with a relation pointing to the root object.
6. View objects - ?
7. Dynamic search objects - Used in advanced search, supports ranges and operators
Could you please specify in which scenarios we have to go for Access Objects and Root Objects
Thanks,
Bujji -
How do you reference a valueObject located in main to a custom component created in Catalyst?
Hello,
I have been working with the Catalyst Beta 2 / Flash Builder beta trying to create a photogallery and have hit a little bit of a snag, try as I might I can't seem to find the answer anywhere. I am still new to Flex so please excuse me if this is a basic question, I have been trying to understand more about Flex to make my designs in Catalyst better.
I found this video on Adobe TV: http://tv.adobe.com/watch/rich-internet-applications-101/ria-stepbystep-16-binding-a-data- service-to-flash-builder-components/
It's wonderful and I have the datalist I created in Catalyst working with the XML file I generated but I designed my little photogallery a bit diffrent, I created a Custom Component in Catalyst so that when you click an item on the DataList it pop's up a little screen with a larger photo in on it, rather then having an image in the main application. Now my problem seems to be that I can't refrence the valueObject I created with the wizard as it's in my Main.mxml file, is there a way to refrence it from my Custom Component so the larger image will display? Is there a way to let the component know which item on the dataList in the main application is selected and display the correct image?
I should also say I really enjoy working with the Beta for both Flash Builder / Catalyst, thanks for the hard work!
Thanks for the help,
ChrisI am afraid you cannot bind to static properties in Windows Store Apps. It is simply not supported.
You could create a proxy class that exposes the static command property and bind to this property of an instance of the proxy object:
http://stackoverflow.com/questions/14186175/bind-to-a-static-field-in-windows-8-xaml
http://stackoverflow.com/questions/4708711/how-can-i-use-the-xstatic-extension-for-phone7-silverlight-apps
You will of course have to create an instance of the proxy object. There is no way around this.
Please remember to mark helpful posts as answer to close your threads and then start a new thread if you have a new question.
Maybe you are looking for
-
Get the pc name with domain name and add it to my properties file using commands
i want to get the pc name with domain name and add it to my properties file using powershell . sid
-
I cannot open a movie in my e-mail and it is from the same phone that I opened one from earlier.
-
Canon 20D USB to an Android Tablet - is it possible to tether my Canon 20D to an Android Tablet
I would like to tether my Canon 20D to an Android Tablet so that my images are saved automatically and installantly to the CF card and to the Android Tablet. Is this possible?
-
Can I update/work Adobe Photoshop CS on OS X Mavericks?
I recently updates this computer from 10.6.8 to 10.9.1. My dad lost his disc to photoshop, but I might be able to find it if I absolutely need to. I'm unable to find anywhere that I can update to Photoshop CC, and none of the CS versions will work no
-
Hi, Every Sql Query I create in BI Publisher has ROWSET as the root node. I need to be able to change this to something more unique and descriptive so that my label printing will understand which template to use. Is there a way within the SQL Query s