Setting styles dynamically

Can I set a style dynamically? In the component below, I want
to change the button style (in the onChange event handler)
according to the selected state of the button, but the style is
ignored and replaced with a default version of a button. If not, is
there a work around that you would recommend or do I need to
restructure my code?

"SiHoop" <[email protected]> wrote in
message
news:[email protected]...
> Can I set a style dynamically? In the component below, I
want to change
> the
> button style (in the onChange event handler) according
to the selected
> state of
> the button, but the style is ignored and replaced with a
default version
> of a
> button. If not, is there a work around that you would
recommend or do I
> need to
> restructure my code?
>
> <?xml version="1.0" encoding="utf-8"?>
> <mx:VBox xmlns:mx="
http://www.adobe.com/2006/mxml"
>
implements="mx.controls.listClasses.IDropInListItemRenderer">
> <mx:Script>
> <![CDATA[
> import mx.controls.listClasses.BaseListData;
> import mx.controls.Button;
> import MyDataGrid_sh
> private var _listData:BaseListData;
> [Bindable]public var key:String;
> [Bindable]public var linkButton:String="linkButton";
>
> private var myDataGrid:MyDataGrid_sh;
>
> public function get listData():BaseListData {
> return _listData;
> }
> public function set listData( value:BaseListData ):void
> _listData = value;
> myDataGrid = _listData.owner as MyDataGrid_sh;
> key=_listData.uid;
> }
> private function onChange(event:Event):void{
> parentDocument.hideMapMarker()
> var i:int=myDataGrid.toggledButtons.getItemIndex(key);
> //Select button
> if(i==-1 && (event.target as
Button).selected==true){
> myDataGrid.toggledButtons.addItem(key)
> dg_Button.styleName="linkButton1"
>
> }
> //Release back to original state
> if(i>=0 ){
> myDataGrid.toggledButtons.removeItemAt(i);
> dg_Button.styleName="linkButton"
> }
> myDataGrid.invalidateList();
> }
> override protected function
updateDisplayList(unscaledWidth:Number,
> unscaledHeight:Number):void{
> super.updateDisplayList(unscaledWidth, unscaledHeight);
> if(key){
> var i:int=myDataGrid.toggledButtons.getItemIndex(key);
> if(i>=0){
> dg_Button.selected=true;
> }
> else{
> dg_Button.selected=false;
> }
> }
> }
> ]]>
> </mx:Script>
> <mx:Button styleName="{linkButton}" id="dg_Button"
width="50"
> toggle="true" click="onChange(event)"/>
> </mx:VBox>
I think the problem may be that you're binding the styleName
property, so it
might be setting it right back even if it gets set properly.
try <mx:Button styleName="linkButton" id="dg_Button"
width="50" ...
Unless you need what VBox gives you, you may want to consider
using a
lighter base component. At least go to Canvas, if you're not
comfortable
with UIComponent. If you want to try your hand at
UIComponent, there's a
simple example of one fully commented as part of my DataGrid
with
styleFunction example
http://flexdiary.blogspot.com/2008/09/extended-datagrid-with-stylefunction.html
HTH;
Amy

Similar Messages

  • How to set up Dynamic Variants for job which is based on Pay Period

    Hi,
    We need to set up dynamic variant for payroll interface.  This interface is based on Pay periods and that is why we need to use different variant for each month.  Letus know how to set up dynamic variant which will take care of Pay Periods

    Hi,  Thnx for reply.
    We are not changing the control records, current period will be some old period in system. 
    payroll is not processed in SAP,

  • How to set up dynamic dns?

    Hi everybody,
    could anybody help me to set up Dynamic DNS in the Airport Extreme? I am using Airport Utility 5.5.3
    I also have dlink dns service active
    Thank You
    Manolo Fernández

    The following is the basic setup for DDNS on the AirPort using AirPort Utility v5x:
    AirPort Utility > Select the base station > Manual Setup >AirPort > Base Station tab > Edit ...
    Use dynamic global hostname (checked)
    Hostname: <enter your DDNS service domain here>
    User: <enter your DDNS user account name>
    Password: <enter your DDNS user account password>
    Click "Done."
    AirPort Utility > Select the base station > Manual Setup > Disks > File Sharing tab > Share disks over the Internet with Bonjour (checked)

  • Can we set the dynamic data source when using getReportParameters() ?

    Hello!
    I have a report where one of its parameters refers to a list of values (LOVs). This list of values is an SQL Query type. When the data source used in the report is defined in the BI Publisher server, I'm able to get the report parameters using the getReportParameters() function in my application. However, if the data source is not defined the function throws an exception, which is understandable.
    I decided to dynamically set the data source so that even if the data source used by the report is not defined in the BI Publisher server, it still will be able to get the LOVs for the parameter. I tried setting the JDBCDataSource of the dynamicDataSource for the ReportRequest object that I passed to the getReportParameters() function. Please see the sample code below:
    reportRequest.dynamicDataSource = new BIP10.BIPDataSource();
    reportRequest.dynamicDataSource.JDBCDataSource = new BIP10.JDBCDataSource();
    setReportDataSource(reportRequest.dynamicDataSource.JDBCDataSource, connectstr, jdbc, dc); //function to set the values for JDBCDataSource object
    reportParams = webrs.getReportParameters(reportRequest, uid, pwd); //call the getReportParameters
    I was expecting this to work as this is what I did to dynamically set the data source before calling the runReport function. So, my question is -- can we set the dynamic data source when using getReportParameters() ? I tried this both in versions 10g and 11g. It does not seem to work on both versions.
    Regards,
    Stephanie

    report_id column of apex_application_page_ir_rpt can help us uniquely identify each saved report.
    We can assign this report_id value to a page item and this page item can be put in the Report ID Item text box of the Advanced section of the Report Attributes page of the IR.
    This should load the saved report identified by report_id and you can get rid of javascript
    Regards,
    Vishal
    http://obiee-oracledb.blogspot.com
    http://www.packtpub.com/oracle-apex-4-2-reporting/book
    Kindly mark the reply as helpful/correct if it solves your problem

  • How to set a dynamic filter to a prompted one?

    Hello:
    I have a dashboard prompt whose values determine the columns for a constructed dynamic filter column using case statement.
    There is another dashboard prompt whose value determine the the values for the dynamic filter column.
    I have a need to set this dynamic filter to the operator 'is prompted'. According to the OBIEE documentation, the requirement for 'is prompted' filter is to have the dashboard prompt column match with the filter column.
    I currently use a presentation variable for the dashboard prompt column that gives the filter value.
    How do I make my dynamic filter to be prompted (for pre-filtering results as a default behavior) and subsequently use the presentation variable (derived from the dashboard prompt) if a user enters the appropriate prompt values?
    Here is an example:
    Dashboard prompt: Location Type-> (State, District, City) (The case statement on my filter determines the appropriate logical column State or District or City)
    Filter Value: Dallas (pv1)
    The dynamic filter will generate "City" = '@{pv1}' (Dallas in the above example)
    I want this dynamic filter to be set to 'is prompted' for pre-filtering results as a default behavior.
    Thanks for reading this far and looking forward to your suggestions.
    Regards
    Sankar Bala

    Please read this carefully, you may find what you are looking for:
    Dynamic dashboard prompts and columns used in multifunctional report, full guided navigation
    http://108obiee.blogspot.com/2009/08/dynamic-dashboard-prompts-and-columns.html
    Or this one:
    http://obiee101.blogspot.com/2009/04/obiee-dynamic-prompt-content.html
    Regards
    Goran
    http://108obiee.blogspot.com

  • How to set a dynamic textfield?

    How to set a dynamic textfield that can baseon the user input data to resize the textfield height and width? Beside, I would like to copy the MS word table into the Form textfeild with the original design, how to do that? Many thanks!

    You need to check two things:
    1- Make sure to check the "Allow Multiple Lines" under the object tab.
    2- Check the Expand to Fit checkboxes under the layout tab.
    Jasmin

  • C:set with dynamic variable name

    Hello,
    we have a litte market system.
    we iterate over the articles to display them on a page
    foreach article type we have to include a popup, but only once foreach article type.
    So if we have more than one article of the same type, the popup should be included only one time.
    <c:forEach var="article" items="#{MyArticleController.entities}">
        <c:if test="${requestScope[article.dtype] != true}">
            <!-- <ui:include src="/market/details/#{article.dtype}.xhtml"/>  -->          
            <c:set scope="request" var="${article.dtype}" value="1" />
        </c:if>
        <!-- <ui:include src="/market/preview/#{article.dtype}.xhtml"/>-->
    </c:forEach>I think the line with the c:set seems to be the problem.
    How can I solve this problem. How can I set a dynamic value and test against it later?
    Thanks
    Dirk

    You were close with your first example.
    However as noted, the <c:set> tag doesn't accept a dynamic expression for the "var" attribute.
    Suggested alternative: instead of using request attributes, have a seperate map
    <jsp:useBean id="articleTypeUsed" class="java.util.HashMap"/>
    <c:forEach var="article" items="#{MyArticleController.entities}">
        <c:if test="${not empty articleTypeUsed[article.dtype]}">
            <!-- <ui:include src="/market/details/#{article.dtype}.xhtml"/>  -->          
            <c:set target="${articleTypeUsed}" property="${article.dtype}" value="1" />
        </c:if>
        <!-- <ui:include src="/market/preview/#{article.dtype}.xhtml"/>-->
    </c:forEach>That should solve your issue with translating this java code into jstl.
    Whether the mix of JSTL and JSF/ui will work well together is a completely seperate issue, and one I can't really help with.

  • Setting styles with javascript

    getelementby('id').setAttribute lets you change a HTML objects attributes
    However the style attirubute (getelementby('id').setAttribute("style","value goes here")); actually contatins many settings in what javacript sees as a single attribute.
    as a result everytime i change a style setting with this i have to re-insert all of the other styles.
    this is inconvinient at best.
    and at worst means i have to store all of the set styles as javascript attributes and re-insert the whole lot.
    is there another way of doing this
    so that i can add or delete styles without the rest of the set styles being affected?

    function(){return A.apply(null,[this].concat($A(arguments)))}
    I_Know_Nothing_at_all wrote:
    I'm confused. Are you using the getElementby to write or set an individual style for multiple elements all over a page?
    I use it to set a style for an element or elements where the style is dependant on some other factor, or has to be changed in responce to an event.
    CSS alone cant do this because it does not have event listenters (except for psudo events such as :hover) cannot detect the styles and setting of anything (except for media rules) and does not have any sort of evaluative functions such as IFs, CASEs and basic arithmetic.

  • Setting Styles in AS3

    Hi,
    I am trying to set styles on components in AS3 via an
    external stylesheet because the documentation suggests that using
    the setStyle method should only be reserved for styles that change
    at runtime.
    Quote:
    A common mistake that impacts performance is overusing or
    unnecessarily using the setStyle() method. In general, you need the
    setStyle() method only when you want to change styles on existing
    objects. Do not use it when setting up styles for an object for the
    first time. Instead, set styles in an <mx:Style> block,
    through an external CSS style sheet, or as global styles.
    Are the styles that can be set via an external stylesheet in
    AS3 limited to those defined in flash.text.stylesheet? If so, am I
    correct in thinking that setting styles via a stylesheet is not the
    way to go as this seems a very limited set? For example I want to
    set the background color on a TextArea control and padding around a
    piece of text. The setStyle method works fine but I cannot find a
    way to apply the same via an external stylesheet.
    TIA

    You are right, not all styles can be setted using CSS. In
    docs there is a flag "CSS Inheritance" for it.
    For example you mention about backgroundColor, this
    description is
    backgroundColor
    Type: uint
    Format: Color
    CSS Inheritance: no
    Background color of a component."

  • [svn:fx-trunk] 11655: Added logic to allow getStyle to return locally set style values early on  (before the instance has been added to DOM).

    Revision: 11655
    Author:   [email protected]
    Date:     2009-11-11 08:27:42 -0800 (Wed, 11 Nov 2009)
    Log Message:
    Added logic to allow getStyle to return locally set style values early on (before the instance has been added to DOM).
    QE notes:  None
    Doc notes:  None
    Bugs: SDK-22198
    Reviewer: Glenn
    Tests run: Checkin
    Is noteworthy for integration: No
    Ticket Links:
        http://bugs.adobe.com/jira/browse/SDK-22198
    Modified Paths:
        flex/sdk/trunk/frameworks/projects/framework/src/mx/core/UIComponent.as

    Please can u answer it fast

  • Date to be setted as dynamic radiobutton

    Hi,
    In my requirement, I'm actually using the LDB's and getting a desired selection screen.
    But i need to addd one more field in the Sel. screen. ie., date.
    I want tht date to be setted as dynamic radiobutton .
    parameter for presentation server filename
    PARAMETERS : rb_date RADIOBUTTON GROUP disp DEFAULT 'X'.
                             rb_date RADIOBUTTON GROUP disp .
    How shall the progrm recognise tht field as date.

    In my requirement, I'm actually using the LDB's and getting a desired selection screen.
    But i need to addd one more field in the Sel. screen. ie., date.
    I want tht date to be setted as dynamic radiobutton .
    parameter for presentation server filename
    PARAMETERS : rb_date RADIOBUTTON GROUP disp DEFAULT 'X'.
    rb_other RADIOBUTTON GROUP disp .
    in this RB_other field i wud like to add one more field to type the desired date.
    can any let me know how to proceed on.
    Regards
    Rohini.

  • Set-up Dynamic time series

    Hi,
    I have just tried to activate dynamic time series members in the outline.
    In the outline I can now see "Active time series members: Y-T-D behind the dimension name "Periode".
    I was in the assumption that new Y-T-D members would be created. But this is not the case.
    I want to use the YTD functionality in financial reporting. But am unable to select DTS members.
    What is the proper way to set up DTS?

    Hi,
    Proper way of setting-up Dynamic time Series is: -
    1- Define one dimension as 'Time' in outline.
    2- Select any eight predefined Dynamic Time Series members like Q-T-D, Y-T-D and associated it with any generation. For example, if you want to calculate quarter-to-date values, you enable the Q-T-D member and associate it with the generation to which you want to apply the Dynamic Time Series member.
    3- Dynamic Time Series members are not displayed as members in the database outline. Instead, Essbase lists the currently active Dynamic Time Series members in a comment on the time dimension. For Ex. Y-T-D is showing after dimension 'Period' in yourcase.
    4- When you retrieve a Dynamic Time Series member, you need to tell Essbase the time period up to which you want to calculate the period-to-date value. This time period is known as the latest time period and must be a level 0 member on the time dimension. For. Ex - For example, Q-T-D(May) returns the quarter-to-date value by adding values for April and May.
    Hope it answers you.
    Atul K,

  • How to set style italic when i use ole2 to deal with excel?

    hi ,every body.
    i received a requirement today,in which user want to set style italic?
    pls tell me how can i do it, tks!

    Use
    SET PROPERTY OF GS_FONT 'Italic' = '1' .

  • Defaulting to previously set styles

    Hi there. Silly but annoying problem....
    I open a file that is full of all sorts of styles. I love styles and use them all the time but when I add a new text box of object to a page, I want it to be UNSTYLED but instead, it automatically defaults to a previously set style. I have to go into styles and and click "None". How can I set it up so a new element does NOT default to a previosuly set style?
    I am on Mac OS 10.4.11 - InDesign CS3
    Thanks!

    Open the Object Styles panel.
    You have two choices, at this point, either create a new style and set it as the default, or edit [Basic Text Frame] and continue to use it, whcih is probably easier. To do that, double-click the name to open the style definition dialog and then click the Paragraph Styles line in the top list in the left section. In the dropdown change the style to [No Paragraph Style], make sure the box next to Paragraph Styles in the list is checked, and say OK.

  • Linksys WRT120N Router -- How to set to "Dynamic"?

    I am having trouble getting my work computer to connect wireless to my home router.  I was told it was because my work computer is set to "dynamic" and my home router is probably set to "static"... how to I set my home router (Linksys WRT120N) to "dynamic"?  I'm Dumb Dora when it comes to this so specific step-by-step directions would be appreciated.

    CA_Martie,
    Have you confirmed the settings on your router?
    Ensured DHCP is enabled
    Have you configured your wireless network settings on the router? 
    SSID Name
    N or G network (both?)
    Security settings?
    Can any other devices connect wirelessly?
    1 x r7000 Nighthawk 1.0.3.24
    3 x WNDR4500 v1 / v2
    e4200 Rev 1 f/w 1.0.05
    e3000 Rev 1 f/w 1.0.04
    QNAP TS-219P-II 4TB
    dns323 ext3 4TB
    Roku N 1080p
    Altigen ip-710 VOIP phone
    Other Routers - Asus (just ok), DLink (junk), Netgear (Current Favorite) & ProSafe, wrt54g & G2
    wvc54gca - Dumped this as it only support TKIP encryption & 54mbps

Maybe you are looking for

  • W540 piece of junk DO NOT BUY!!!

    Hi, we've ordered two W540's for one of our larger clients. One unit was DOA. still waiting to hear back from Synnex if it's approved to be replace or not BUT now I'm not sure if I want another one of these units. The 2nd unit we have had seemed to w

  • How to export 9i and import in 11g for EBS 11i

    Hi refered note 557738.1 Export/import notes on Applications 11i Database 11g note 452783.1 Oracle Applications Release 11i with Oracle 11g Release 1 (11.1.0) It required the use of datadump. And upgrade the source database to 10gR2 or 11g. We cannot

  • Iphone 4 won't update to iOS 5 software!! HELP

    I've been trying to update my iphone 4 to the iOS 5 software but an error message (3194) keeps popping up and won't let me download it. i've tried everything the troubleshoot has told me to do;my itunes is also up to date...i dont know what else to d

  • Namespace Change at the target

    Hi All, I am doing a Proxy to SOAP scenario. I need to change the namespace of the target WSDL . The mapping works fine but there is a requirement where in I need to change the target namespace. Can some one please help me on this. I want it after me

  • Ihoto quits unexpectedly

    Lately, IPhoto crashes/quits when i'm importing pictures. I usually get through almost all of my pictures being imported and then Iphoto quits. When I go into the Finder Iphoto Library, I see that the pictures are stored in the respective month and d