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

AJAX Callback - need new eyes

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

    AJAX Callback - need new eyes

    My eyes are worn out on this simple one.

    Using the System onRowRender, I have this callback:

    Code:
    var field1 = {grid.Object}.ajaxCallback('G','{Grid.RowNumber}:all','Is_Checked','','_getData=true');
    alert(field1);
    The function is simply this (for now):

    Code:
    function Is_Checked as c (e as p)
    	Is_Checked = "true"
    end function
    Yet the alert box, no matter what I put in Is_Checked(), returns a "false". I've tried all sorts of variations.

    Anyone see why?
    -Steve
    sigpic

    #2
    Re: AJAX Callback - need new eyes

    Haven't really figured out what is going on, but if you do this it will work:

    Code:
    function Is_Checked as c (e as p)
        value = "true"
        Is_Checked = "alert('" + js_escape(value) +  "');"
    end function
    Code:
    var field1 = {grid.Object}.ajaxCallback('G','{Grid.RowNumber}:all','Is_Checked','','_getData=true');
    Peter
    AlphaBase Solutions, LLC

    [email protected]
    https://www.alphabasesolutions.com


    Comment


      #3
      Re: AJAX Callback - need new eyes

      Yeah, I can do that OK Peter. But using field1 after the callback in the javascript portion continues to fail. This is a stepping stone to a larger statement that depends on the value of field1 in the javascript.
      -Steve
      sigpic

      Comment


        #4
        Re: AJAX Callback - need new eyes

        Try this :

        Code:
        {grid.Object}.ajaxCallback('G','{Grid.RowNumber}:all','Is_Checked','','_getData=true');
        Code:
        function Is_Checked as c (e as p)
            Is_Checked = "var field1=true;alert(field1);"
        end function
        Remember that Ajax callbacks are asynchronous.
        Bob Moore


        Comment


          #5
          Re: AJAX Callback - need new eyes

          Remember that Ajax callbacks are asynchronous.
          I think this is the problem I'm having Bob. I can do what you suggest, but if I move the alert() into the javascript after the callback, it fails.

          I'm looking to set checkboxes in a checkbox column based on values in a table. I can set all the checkboxes just fine in the onRowRender, but things fall apart when I try to do any data work to decide which checkboxes to check.
          -Steve
          sigpic

          Comment


            #6
            Re: AJAX Callback - need new eyes

            Originally posted by Bob Moore View Post
            Remember that Ajax callbacks are asynchronous.
            Duuhhh! Of course. How soon we (me) forget. :(
            Thanks for the reminder. :)
            Peter
            AlphaBase Solutions, LLC

            [email protected]
            https://www.alphabasesolutions.com


            Comment


              #7
              Re: AJAX Callback - need new eyes

              "but things fall apart when I try to do any data work to decide which checkboxes to check."
              I think you could accomplish what you want either server side .. if using a SQL back-end, calling a stored procedure may be the most efficient, and refreshing the component on the callback return or client side by just iterating through the result set in the callback and generating the JavaScript to set the value of the checkbox for each row.
              Bob Moore


              Comment


                #8
                Re: AJAX Callback - need new eyes

                Bob - can you 'splain that again? I don't quite understand the mechanics of your suggestion.

                Thanks.
                -Steve
                sigpic

                Comment


                  #9
                  Re: AJAX Callback - need new eyes

                  Is the checkbox populated by a logical field in the table or is it the checkbox select column that can be enabled in the grid builder?

                  If it's a logical field in a table that is displayed in the grid then it's value could be set server side and the grid could be simply refreshed. Here the callback would just generate the JavaScript to refresh the grid.

                  If it's the checkbox select column, you would need to generate the JavaScript in the callback to toggle the checkbox.
                  Bob Moore


                  Comment


                    #10
                    Re: AJAX Callback - need new eyes

                    It's the checkbox select column. I need to examine data from a seperate table to decide whether to check the box or not.

                    I quite frankly have no idea how to generate the javascript as you describe, or what needs to be generated. Is there an example someplace?

                    Whatta complex mess just trying to check checkboxes...

                    My need is simple. In pseudocode:

                    1. Build a key: Current_Row.Location_ID + session.current_UserID
                    2. Check whether a record with that key exists in a table
                    3. Check the Current_Row.Checkbox if it does
                    Last edited by Steve Workings; 01-05-2011, 07:09 PM.
                    -Steve
                    sigpic

                    Comment


                      #11
                      Re: AJAX Callback - need new eyes

                      FYI .. I just tried some test code to toggle the checkbox select from a button in the grid and while I can fire the onclick event of the checkbox, the state doesn't change .. you don't see a check.

                      Code:
                      Button onclick event code:
                      
                      $('{Grid.ComponentName}.V.R{Grid.RowNumber}.__ROWCHECKBOX').onclick();
                      If I follow the JavaScript execution chain with a debugger it all looks OK however I suspect there is a scope issue.

                      In any case you're going to have some problems toggling the state of the checkbox control. I recall being able to do this in a previous build but I can't in the current build.

                      So my suggestion is to either add a dummy logical variable or simply another logical column to the table, display that value as a checkbox in the grid and toggle the state of that field. If you add the column to the table, you can update the value of the field server side in the Xbasic callback and just refresh the grid with the returned JavaScript. Or .. you could also update the value client side, with the returned JavaScript.

                      I am not aware of any sample code or tutorials on this. If I find the time I'll put something together, but I'm pretty swamped with work right now!
                      Bob Moore


                      Comment


                        #12
                        Re: AJAX Callback - need new eyes

                        Thanks Bob. I was starting to decide to revise my grid configuration. It's a shame, because I was otherwise finished with it, and now I need to rebuild and test through again. All except this last piece. My first approach will be to change my source from a table to a SQL expression -- it should be the least amount of trouble, shouldn't slow things down much, and maybe provide me with the values I need right at the client side.
                        -Steve
                        sigpic

                        Comment

                        Working...
                        X