The Alpha Software Forum Participation Guidelines

The Alpha Software Forum is a free forum created for Alpha Software Developer Community to ask for help, exchange ideas, and share solutions. Alpha Software strives to create an environment where all members of the community can feel safe to participate. In order to ensure the Alpha Software Forum is a place where all feel welcome, forum participants are expected to behave as follows:
  • Be professional in your conduct
  • Be kind to others
  • Be constructive when giving feedback
  • Be open to new ideas and suggestions
  • Stay on topic

Be sure all comments and threads you post are respectful. Posts that contain any of the following content will be considered a violation of your agreement as a member of the Alpha Software Forum Community and will be moderated:
  • Spam.
  • Vulgar language.
  • Quotes from private conversations without permission, including pricing and other sales related discussions.
  • Personal attacks, insults, or subtle put-downs.
  • Harassment, bullying, threatening, mocking, shaming, or deriding anyone.
  • Sexist, racist, homophobic, transphobic, ableist, or otherwise discriminatory jokes and language.
  • Sexually explicit or violent material, links, or language.
  • Pirated, hacked, or copyright-infringing material.
  • Encouraging of others to engage in the above behaviors.

If a thread or post is found to contain any of the content outlined above, a moderator may choose to take one of the following actions:
  • Remove the Post or Thread - the content is removed from the forum.
  • Place the User in Moderation - all posts and new threads must be approved by a moderator before they are posted.
  • Temporarily Ban the User - user is banned from forum for a period of time.
  • Permanently Ban the User - user is permanently banned from the forum.

Moderators may also rename posts and threads if they are too generic or do not property reflect the content.

Moderators may move threads if they have been posted in the incorrect forum.

Threads/Posts questioning specific moderator decisions or actions (such as "why was a user banned?") are not allowed and will be removed.

The owners of Alpha Software Corporation (Forum Owner) reserve the right to remove, edit, move, or close any thread for any reason; or ban any forum member without notice, reason, or explanation.

Community members are encouraged to click the "Report Post" icon in the lower left of a given post if they feel the post is in violation of the rules. This will alert the Moderators to take a look.

Alpha Software Corporation may amend the guidelines from time to time and may also vary the procedures it sets out where appropriate in a particular case. Your agreement to comply with the guidelines will be deemed agreement to any changes to it.

Bonus TIPS for Successful Posting

Try a Search First
It is highly recommended that a Search be done on your topic before posting, as many questions have been answered in prior posts. As with any search engine, the shorter the search term, the more "hits" will be returned, but the more specific the search term is, the greater the relevance of those "hits". Searching for "table" might well return every message on the board while "tablesum" would greatly restrict the number of messages returned.

When you do post
First, make sure you are posting your question in the correct forum. For example, if you post an issue regarding Desktop applications on the Mobile & Browser Applications board , not only will your question not be seen by the appropriate audience, it may also be removed or relocated.

The more detail you provide about your problem or question, the more likely someone is to understand your request and be able to help. A sample database with a minimum of records (and its support files, zipped together) will make it much easier to diagnose issues with your application. Screen shots of error messages are especially helpful.

When explaining how to reproduce your problem, please be as detailed as possible. Describe every step, click-by-click and keypress-by-keypress. Otherwise when others try to duplicate your problem, they may do something slightly different and end up with different results.

A note about attachments
You may only attach one file to each message. Attachment file size is limited to 2MB. If you need to include several files, you may do so by zipping them into a single archive.

If you forgot to attach your files to your post, please do NOT create a new thread. Instead, reply to your original message and attach the file there.

When attaching screen shots, it is best to attach an image file (.BMP, .JPG, .GIF, .PNG, etc.) or a zip file of several images, as opposed to a Word document containing the screen shots. Because Word documents are prone to viruses, many message board users will not open your Word file, therefore limiting their ability to help you.

Similarly, if you are uploading a zipped archive, you should simply create a .ZIP file and not a self-extracting .EXE as many users will not run your EXE file.
See more
See less

Accessing {dialog.ComponentName} onInitializeComplete

  • Filter
  • Time
  • Show
Clear All
new posts

  • Accessing {dialog.ComponentName} onInitializeComplete

    Hey there!

    I've created a button list that's being driven from a data series. Occasionally, the data can cause the button list to take up more space than the page has, which creates a scrollbar at the bottom.

    To get around this, I wanted to style the parent ButtonList control to use the CSS grid to effectively "wrap" my buttons around the page.

    So, in the onInitializeComplete client-side event, I used JavaScript to adjust the styling of the control (because for some reason no styling properties are available in Alpha for button lists). Initially I hardcoded the ID, like this:

    document.getElementById("DLG1.V.R1.SELECT_PROJECT.CONTROL").style = "display: grid; grid-template-columns: repeat(3, 1fr); grid-gap: 1px;"
    This worked. However, when I published to the server, the component name changed. So I tried to use the {dialog.ComponentName} placeholder to grab the component name, like so:

    document.getElementById({dialog.ComponentName} + ".V.R1.SELECT_PROJECT.CONTROL").style = "display: grid; grid-template-columns: repeat(3, 1fr); grid-gap: 1px;"
    Here's the weird thing... now I'm getting an error:

    VM1111:411 Uncaught ReferenceError: TBI_UX_DASH_16651DGEJ is not defined

    When I inspect my controls, this is indeed the appropriate component name. What's weirder is that if I hard-code the component name that's showing on the server, it can select & style the element just fine. Is onInitializeComplete firing before the component is fully initialized perhaps? Would there be a better event to place this code in, or a better way of styling the ButtonList without using JavaScript that I'm missing entirely?

    Thank you!

  • #2
    Re: Accessing {dialog.ComponentName} onInitializeComplete

    Try this in your onInitializeComplete:

    var btnLstObj = {dialog.Object}.getControl('BtnLst');
    var btnCont = $(btnLstObj.contId);
    alert( ); = "grid"; = "repeat(3, 1fr)"; = "1px";
    alert( );
    If the second alert does not include the properties that were set then your browser does not support the new "grid" style properties. So, typically this won't work in "Working Preview" or "Live Preview" unless you have configured Alpha to using something other than IE.

    1) There are multiple ways to get the container element for the button list. I used the UX "getControl" method to get the JavaScript object that Alpha sets up for the ButtonList and from there I used its 'contId' property and used the jQuery shortcut to get a DOM element pointer (btnCont).

    2) When you have a pointer to a DOM element you cannot set the properties all at once using your syntax. There is probably some way to do it, but I'm just used to setting each property individually. Also, watch out, the property names are different than what CSS text uses. I use the Chrome Developer Tools to inspect the DOM element and get the property names from that. (I'm always worried that some browsers may have chosen different property names. So, if someone can show how to set these using CSS Text property names then that would probably be a better way to go.

    3) I have only used the ButtonList on the Detail View container attached to a LIST. And, under that condition the ButtonList is always recreating itself from scratch. This means setting any DOM element properties of the button list container or any of its buttons must be done every time Alpha refreshes the button list. That is, using "onInitializeComplete" would not be sufficient. I don't know if the ButtonList gets recreated from scratch when it is on the main part of a UX. At a minimum, I think you would also need this code in the 'onSynchronizeDialog' - that embed gets called when a cached UX is re-used. In which case, I don't think 'onInitializeComplete' gets called. In my UX, I use the 'onRenderComplete' instead of 'onInitializeComplete', along with 'onSynchronizeDialog'.

    4) This point is for ALPHA SOFTWARE - There are two critical events that the ButtonList needs to provide access to, for us to interject custom javascript:
    a) Before the ButtonList is "Refreshed", and
    b) After the ButtonList is "Refreshed"
    This is where code to achieve the OP's effect should be embedded (after button is "Refreshed").
    The "Before Refresh" embed is needed, so the ButtonList object can be tweaked, like when its "Theme" needs to be removed. Or, at a minimum the ButtonList needs to have an internal property that says to not include the UX's Theme and/or replace the Theme with something else or blank.

    5) The ButtonList can do a whole lot more when you set its properties manually instead of using only what the UX ButtonList builder allows.
    Last edited by RichCPT; 02-28-2019, 02:38 PM. Reason: some typos fixed.


    • #3
      Re: Accessing {dialog.ComponentName} onInitializeComplete

      Oh, for an easy solution: I think you could create a "local CSS" class with the properties that you want and then in the ButtonList properties, set the "Control container class name".
      You probably have to include "!important" at the end of your CSS properties, because Alpha usually likes to override anything you do, by putting their CSS class name after yours instead of giving you three options: 1) omit Alpha class, 2) put Alpha class first, 3) put Alpha class last.


      • #4
        Re: Accessing {dialog.ComponentName} onInitializeComplete


        You are awesome my friend! I actually did try your second solution before posting (replacing the A5CW container with my own class), but the properties weren't being applied. I'll try it with !important added, and if that doesn't work, I'll give your first solution a try. Thank you so much!


        • #5
          Re: Accessing {dialog.ComponentName} onInitializeComplete

          Originally posted by Cameron.Smith View Post
          This worked. However, when I published to the server, the component name changed. So I tried to use the {dialog.ComponentName} placeholder to grab the component name, like so:

          document.getElementById({dialog.ComponentName} + ".V.R1.SELECT_PROJECT.CONTROL").style = "display: grid; grid-template-columns: repeat(3, 1fr); grid-gap: 1px;"
          Your syntax is a bit off... you don't use a placeholder like that in this situation. I also get an error when using your syntax. Use this instead...

          document.getElementById("{dialog.ComponentName}.V.R1.SELECT_PROJECT.CONTROL").style = "display: grid; grid-template-columns: repeat(3, 1fr); grid-gap: 1px;"
          The placeholder goes inside the double quotes... and gets evaluated as part of the string.
          Last edited by Davidk; 02-28-2019, 06:53 PM.


          • #6
            Re: Accessing {dialog.ComponentName} onInitializeComplete

            If it does not work then its probably due to another inner container <div> that needs to have the properties set. There are two nested <div> and alpha applies the specified class to the outer div, which causes problems when setting attributes that are not inheritable.

            This example accomplishes setting a fat border around the buttons:

            (In the UX Local CSS):
            .myButtonWrapper {
            background-color: PapayaWhip !important;
            border: 5px !important solid Bisque !important;
            padding: 10px !important;

            ButtonList "Control container class name" = myButtonWrapper

            If the CSS attributes have to be set on the inner HTML then I guess you'd have to get an element pointer to it and use JavaScript as previously discussed. If the ButtonList is on the main part of a UX then I think the following should work to get a pointer to the inner <div>:

            var id = '{dialog.ComponentName}.V.R1.BTNLST.CONTROL';
            var ele = $(id);
            $acn( ele, 'myButtonWrapper');

            Replace 'BTNLST' with the name/id of your ButtonList.
            I used multiple lines of code, so it is easier to debug.
            Last edited by RichCPT; 02-28-2019, 06:26 PM. Reason: added $acn to Add Class Name to element.


            • #7
              Re: Accessing {dialog.ComponentName} onInitializeComplete

              Here's Mozilla's documentation on setting style properties via JavaScript (Notice they say do not set "" to a string as that property is supposed to be read-only. For multiple assignments, use: = "css style attributes in kebab-case"



              • #8
                Re: Accessing {dialog.ComponentName} onInitializeComplete

                Y'all are amazing! I was able to incorporate your solutions and get it working! Here's some lessons learned:

                1) David was absolutely right - if I put {dialog.ComponentName} within the string it works just fine.
                2) Thanks to Rich, I learned two new things: properly styling using JavaScript and a new function from Alpha for adding classes ($acn). Using the JavaScript you provided, I was able to target the button list control and add my wrapper classes to the two controls that needed them.

                Oh and Rich, P.S.: I tried doing control container class without using JavaScript but that method didn't have any luck :(. Could have been something from my end - it's certainly been a Friday morning here, but I was at least able to get it to work by using JavaScript to target the elements and add the classes.

                Thank you both again for the great information, this will be very helpful for the future!


                • #9
                  Re: Accessing {dialog.ComponentName} onInitializeComplete

                  Do the buttons in your CSS Grid layout look okay? Don't they have missing corners and sides? Alpha's default styles assume that a Button List will have three styles of frames: 1) a First button frame, 2) all the middle button frames, and 3) the last button frame.

                  I'm trying to figure out if a "sub theme" can be used to solve the problem. Otherwise, I wanted to mention a previous newsgroup post about the issue of multi-line ButtonLists using things like "wrap: pre-wrap" and float's and clear's:




                  • #10
                    Re: Accessing {dialog.ComponentName} onInitializeComplete

                    There are at least two other ways to accomplish a multi-line ButtonList without using JavaScript!

                    1) Sub-themes
                    2) CSS Tweaks (Only works with SASS themes like iOS7, Alpha, Android)

                    I've tested these methods (and supplied a sample workspace) under Build 5581.

                    Method 1 keeps everything within the UX.
                    Method 2 stores the CSS Tweaks outside of the UX, which makes it easer to share between UX's.