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

Grid row is not selected before button click so I can't read correct value from row

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

    Grid row is not selected before button click so I can't read correct value from row

    I have a grid with a button on each row that opens another component in a tabbed ui pane. I am setting the tabbed ui pane title to a field value from the grid row, however it is reading the value from the previously selected row, instead of the row on which the button was clicked. It appears the row isn't being selected set until after the component is opened.

    For example let's say the pane title is being set to a grid field called "first name"
    Row 1 has a field value of john
    Row 2 has a field value of bob
    If row 1 is currently selected and I click the button on row 2 the pane title is set to john instead of bob.

    This issue can be verified by adding the following code to the button's js action
    var myrow = {grid.Object}.getSelectedRow();
    window.alert(myrow);

    Any ideas on how to overcome this, is it a bug?

    #2
    Re: Grid row is not selected before button click so I can't read correct value from row

    var myrow = {Grid.RowNumber};
    alert(myrow);
    Last edited by GGandhi; 07-31-2016, 08:02 AM.
    thanks for reading

    gandhi

    version 11 3381 - 4096
    mysql backend
    http://www.alphawebprogramming.blogspot.com
    [email protected]
    Skype:[email protected]
    1 914 924 5171

    Comment


      #3
      Re: Grid row is not selected before button click so I can't read correct value from row

      Hi Ghandi, thanks and yes that code returns the row number for the row on which the button is clicked. However it doesn't solve the issue I mention when passing a field value to the pane title of the component being opened. It always passes the value from the previously selected row, not the row on which the button is clicked.

      Comment


        #4
        Re: Grid row is not selected before button click so I can't read correct value from row

        var name = {grid.Object}.getValue('G','NAME',{Grid.RowNumber});
        alert(name);

        substitute for your fields for name
        thanks for reading

        gandhi

        version 11 3381 - 4096
        mysql backend
        http://www.alphawebprogramming.blogspot.com
        [email protected]
        Skype:[email protected]
        1 914 924 5171

        Comment


          #5
          Re: Grid row is not selected before button click so I can't read correct value from row

          http://screencast.com/t/U31QnwHau
          take a look
          thanks for reading

          gandhi

          version 11 3381 - 4096
          mysql backend
          http://www.alphawebprogramming.blogspot.com
          [email protected]
          Skype:[email protected]
          1 914 924 5171

          Comment


            #6
            Re: Grid row is not selected before button click so I can't read correct value from row

            Tabbed ui has a grid displayed in a pane.
            Grid has a button on each row that opens a UX in a new pane.
            The button uses this javascript to call actions defined in the Code – Javascript Functions area

            var title = {grid.object}.getValue('G','DBFORMNAME',{grid.RowNumber});
            if (title == 'oFormLeaveRequest'){
            {grid.object}.runAction('Open_oFormLeaveRequest');
            } else if (title == 'oFormPettyCashRequest'){
            {grid.object}.runAction('Open_oFormPettyCashRequest');
            }

            In each action I am setting the Pane Title to a grid field called FormName.

            The issue is that the FormName field is being read from the previously selected row, not the row on which the button is clicked. It appears that the grid row is not selected before the button opens the UX.
            This behaviour doesn’t happen if the action js is assigned to the button directly, only when the action js is defined in the Code – Javascript Functions area.

            Comment


              #7
              Re: Grid row is not selected before button click so I can't read correct value from row

              do you think you can post your video so people can see what you want to ado and what is in your way.
              thanks for reading

              gandhi

              version 11 3381 - 4096
              mysql backend
              http://www.alphawebprogramming.blogspot.com
              [email protected]
              Skype:[email protected]
              1 914 924 5171

              Comment


                #8
                Re: Grid row is not selected before button click so I can't read correct value from row

                I just use the action builder, it works every time and you can set the title of the tabbedUI pane simply with something similar to

                Code:
                Related Field Reports for: {Job_Cus_Fullname}
                EASY! Hope that helps!
                NWCOPRO: Nuisance Wildlife Control Software My Application: http://www.nwcopro.com "Without forgetting, we would have no memory at all...now what was I saying?"

                Comment


                  #9
                  Re: Grid row is not selected before button click so I can't read correct value from row

                  http://screencast.com/t/R3xnvBKgIGG

                  another one, just as Charles mentions.
                  thanks for reading

                  gandhi

                  version 11 3381 - 4096
                  mysql backend
                  http://www.alphawebprogramming.blogspot.com
                  [email protected]
                  Skype:[email protected]
                  1 914 924 5171

                  Comment


                    #10
                    Re: Grid row is not selected before button click so I can't read correct value from row

                    Richard, what you need to show is what's involved in the runActions you're calling. Overall, it's just a timing issue. The button code is being executed just before the row has a chance to become current.

                    If you do this in your button...

                    Code:
                    setTimeout(function(){
                    	var myrow = {grid.Object}.getSelectedRow();
                    	alert(myrow);
                    },50);
                    You'll see that delaying the button JS by 50ms allows the grid row to "catch up".

                    If you don't want to use a setTimeout, you could grab the field value in the button JS code... and save it...

                    Code:
                    {grid.Object}.__paneTitle = {grid.object}.getValue('G','LASTNAME',{grid.RowNumber});
                    Now you've got a grid object namespace variable to use.

                    In your Javascript functions... you'll get the current name...

                    Code:
                    alert({grid.Object}.__paneTitle);

                    Comment


                      #11
                      Re: Grid row is not selected before button click so I can't read correct value from row

                      That's why they call it a "Pane" title, lol.
                      NWCOPRO: Nuisance Wildlife Control Software My Application: http://www.nwcopro.com "Without forgetting, we would have no memory at all...now what was I saying?"

                      Comment


                        #12
                        Re: Grid row is not selected before button click so I can't read correct value from row

                        Had to chuckle at that one...

                        Comment


                          #13
                          Re: Grid row is not selected before button click so I can't read correct value from row

                          Here is a video showing the issue http://www.screencast.com/t/JJsVFg7xb

                          Steve, wrapping the button code in a timeout function does get around the issue. So does getting then setting the selected row using the grid.object methods before calling the action js.

                          What perplexes me though is that when clicking the button the correct action js is called (so the js code directly behind the button knows which row has been clicked) but the action js that opens the UX still reads the FormName field from the previously selected row.

                          Thanks for your input everyone.
                          Last edited by [email protected]; 07-31-2016, 10:27 PM.

                          Comment


                            #14
                            Re: Grid row is not selected before button click so I can't read correct value from row

                            {Grid.RowNumber} should not be used in javascript functions or global javascript functions. since you are calling a javascript function from the click of the button( image in your case) this rule applies, i think.
                            i changed your code. see if this helps.
                            i do not know run action is available in version 11, if so i will test when i have time if not i will fashion a javascript function to call and pass the parameter. but would you try and see if it works.

                            Code:
                            var rn = {grid.object}._selectedRow;
                            var title = {grid.object}.getValue('G','DBFORMNAME',rn);
                            if (title == 'oFormLeaveRequest'){
                            {grid.object}.runAction('Open_oFormLeaveRequest');
                            } else if (title == 'oFormPettyCashRequest'){
                            {grid.object}.runAction('Open_oFormPettyCashRequest');
                            }
                            edit: re-reading your last post, it appears that you know this already.

                            action js that opens the UX still reads the FormName field from the previously selected row.
                            my impression why this happens is, when you pass the value using {Grid.RowNumber} there is no time available for the code to change the name before the rest of the code executes. the name is in the global var namespace in the javascript. hence the timeout also helps by slowing the code down. while javascript is a text file it is not executed as interpreted language, it is asynchronous.
                            if this replacement works i would stick with that.
                            Last edited by GGandhi; 08-01-2016, 05:53 AM.
                            thanks for reading

                            gandhi

                            version 11 3381 - 4096
                            mysql backend
                            http://www.alphawebprogramming.blogspot.com
                            [email protected]
                            Skype:[email protected]
                            1 914 924 5171

                            Comment

                            Working...
                            X