Alpha Software Mobile Development Tools:   Alpha Anywhere    |   Alpha TransForm subscribe to our YouTube Channel  Follow Us on LinkedIn  Follow Us on Twitter  Follow Us on Facebook

Announcement

Collapse

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

List Control - action javascript - how to define session variables

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    List Control - action javascript - how to define session variables

    Hi,

    I�m now replacing some of my grids with list controls and I don�t know how to get round to the following:

    In a list control I have inserted a button into each row that the list renders, and then define a javascript action for each button. This will open another UX component and I need to define a session variable at that time, with specific information from the row.

    So far, when using a grid I did as follows:

    Action Javascript -> Open a UX component -> Override settings -> Set session variables
    and then I define the session variable that I want to pass on to the UX component:

    SV_codigo = {javascript}function(rowNum) { return {grid.object}.getValue('G','symbol_alt',rowNum); }(rowNum)


    But this does not seem to work the same way on a list control.

    My question is: How can I define this session variable in the list control?

    thanks,
    javier

    #2
    Re: List Control - action javascript - how to define session variables

    Javier,

    I'd like to ask why you need a session variable in the UX component that you are opening from the List control? What are you doing in the UX that you need a session var?

    Comment


      #3
      Re: List Control - action javascript - how to define session variables

      Originally posted by Davidk View Post
      Javier,

      I'd like to ask why you need a session variable in the UX component that you are opening from the List control? What are you doing in the UX that you need a session var?
      Thanks David.

      From any row in the list control, if I press the buttom I would like to open another UX component (ajax callback) where I pass on 2 sessions variables:

      First, I show the name of the item in a text box control:

      session.SV_nombre

      Second, I define an argument to filter a SQL select statement:

      dim sqlArgs as sql::arguments
      sqlArgs.set("newCodigo",session.SV_codigo)




      Javier

      Comment


        #4
        Re: List Control - action javascript - how to define session variables

        You don't need to use session vars in this case. You can stay in the client and define a Dialog Namespace Object and assign that object properties which are your variables.

        In your first UX, define and set the namespace object...

        Code:
        {dialog.Object}.appVars = {};
        {dialog.Object}.appVars._nombre = 123;
        {dialog.Object}.appVars._codigo = "abc";
        EDIT: This is now corrected... as Rich points out we are working with Parent/Child

        In your second UX, possibly in the Client side event onRenderComplete, access your Parent UX and the vars object in that parent and grab those variables...

        Put one into your textbox control...

        Code:
        var pObj = {dialog.Object}.getParentObject();
        {dialog.Object}.setValue('nameTextbox',pObj.appVars._nombre);
        Do the same for Codigo, but hide that textbox control.

        Then, in your xbasic routine... access that control value with e.datasubmitted.
        Last edited by Davidk; 08-11-2014, 09:45 PM.

        Comment


          #5
          Re: List Control - action javascript - how to define session variables

          The following line for the second UX does not work in in a test that I did:

          {dialog.Object}.setValue('nameTextbox',{dialog.Object}.appVars._nombre);

          The second occurrence of "dialog.object" needs to refer to the first ux.

          So, this is what worked for me in my test of the second UX:

          var o = {dialog.Object}.getParentObject();
          dialog.Object}.setValue('nameTextbox', o.appVars._nombre);

          Comment


            #6
            Re: List Control - action javascript - how to define session variables

            Yes... I forgot we were dealing with Parent/Child objects. Thanks Rich.

            It may still be easier/more straight forward to set namespace variables in the parent UX. But... actually... once you're in the child UX, you can get the parent object, and access the controls directly... no need to create variables in the first place.
            Last edited by Davidk; 08-11-2014, 09:46 PM.

            Comment


              #7
              Re: List Control - action javascript - how to define session variables

              I have been using "Arguments" for passing variables. The "Arguments" do not have to be used or consumed in the SQL statement; they can be used for other things. I'm not too happy with that method, though, as it works differently for UXs and Grids and Alpha seems to be missing some built-in functions to handle it cleanly.

              Comment


                #8
                Re: List Control - action javascript - how to define session variables

                Hello David and Rich,
                I tried your suggestions and it works nicely.
                Thanks so much for your help!!!
                All the best,
                Javier

                Comment


                  #9
                  Re: List Control - action javascript - how to define session variables

                  David, I have two list controls in a UX and want to open the same Embedded UX passing a Company ID field from either one, can this be done without setting a session variable?

                  Comment


                    #10
                    Re: List Control - action javascript - how to define session variables

                    You don't need to pass a variable into your embedded UX. Since it's embedded, it's a child. So, use the .getParentObject() method in the embedded UX (as above) to get a pointer to the parent. Then you can get the value of either list control using that parent object. Let me know if you need an example.

                    Comment


                      #11
                      Re: List Control - action javascript - how to define session variables

                      thanks David, right now I have the embedded UX opening with an Argument, my problem is it only works for one list so I'd like to learn how to do it with getParent like you said, just having a little trouble getting it, here goes:

                      1. I have List1 and List2, both return a CompanyID.
                      2. I have an embedded UX with an OrdersList and a some fields above it for CompanyName and Phone
                      3. What would the getParent statement look like and where would it go? Can it populate the list and the CompanyName/Phone fields?

                      Comment


                        #12
                        Re: List Control - action javascript - how to define session variables

                        I think you're right in the concept of passing data to the child instead of what I suggested... it's easier.

                        List1 and List2 will get the embedded child UX and set a value into a hidden control on the child.
                        The embedded UX List will filter based on an argument which looks at that hidden control.

                        You can also perform a ._filterList method on the embedded UX List.

                        This shows you how to do both processes.

                        http://www.youtube.com/watch?v=UT54K851bE0

                        Comment


                          #13
                          Re: List Control - action javascript - how to define session variables

                          Jim,
                          If you are working with embedded components then David has a great solution.
                          In the case where you open the components in different windows or tabbed-UI panes then I thought I'd mention that sometime ago I posted this the solution that I use for passing arguments between grids and UX's. But as I mentioned above, I'm not completely happy with it.

                          When you have multiple instances of the same component open then you have to be very careful about any JavaScript that you have added to your component. "JavaScript" functions declared in one instance of your component may get overwritten by another instance. This creates quite a problem if you have placeholders in your JS. You also have to consider if the Alpha JavaScript Library will use a cached version of the component or request a new copy of it from the server. It would be best to look at old threads or start another thread for these issues.
                          Last edited by RichCPT; 08-23-2014, 06:55 PM.

                          Comment


                            #14
                            Re: List Control - action javascript - how to define session variables

                            David that looks perfect, it is however kicking my ass lol, I tried both your methods but I cant get the Company ID to pass through. The embedded UX has the hidden field and argument tied to it, if I change the default value of the hidden field (called it "cid") the preview changes accordingly. Code below is in the on click event of the list in the parent ux which is returning the CompanyID field and opening the embedded UX that has the orders list:

                            var cObj = {dialog.Object}.getChildObject('ORDERS2','ux');
                            cObj.setValue('cid',this.value);
                            cObj.refreshListData('Orders');

                            Any Ideas?

                            Comment


                              #15
                              Re: List Control - action javascript - how to define session variables

                              Jim,

                              You write that you're opening the embedded UX. It's usually our language that messes us up. If the UX is embedded... then you're not opening it... right?

                              So... 'ORDERS2' is your embedded UX Alias - as defined in the embedded control on the parent.

                              Unhide cid on the child ux... for testing.

                              Does the value of cid change when you click on a parent List row?

                              Comment

                              Working...
                              X