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

Using a checkbox on a grid

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

    Using a checkbox on a grid

    I'm going to use the grid checkbox to create a where statement for mysql since I need to perform several operations on the checked rows.

    Problem is that I can't find any videos or anything else that shows how to cycle through the grid rows and perform an action on the checked rows.

    example:
    for i = 1 to (number of rows)
    if (row is checked(i)) then (add id to sql where statement)
    next

    any ideas on this or links to videos?

    #2
    Re: Using a checkbox on a grid

    Originally posted by leec2000 View Post
    I'm going to use the grid checkbox to create a where statement for mysql since I need to perform several operations on the checked rows.

    Problem is that I can't find any videos or anything else that shows how to cycle through the grid rows and perform an action on the checked rows.

    example:
    for i = 1 to (number of rows)
    if (row is checked(i)) then (add id to sql where statement)
    next

    any ideas on this or links to videos?
    i just created a video.
    see number 87

    http://news.alphasoftware.com/V10Preview/videos.htm

    Comment


      #3
      Re: Using a checkbox on a grid

      check this threat I posed some useful code there http://msgboard.alphasoftware.com/al...light=checkbox
      Cheers
      Mauricio

      Comment


        #4
        Re: Using a checkbox on a grid

        Thank you Selwyn for the video.

        The last thing I need to do is activate a button on the grid when it regenerates after the show checked button is clicked. Since the show/hide expression is javascript, I can't seem to set a variable to activate the button since all the code I've written is xbasic.

        any ideas?

        Comment


          #5
          Re: Using a checkbox on a grid

          Originally posted by leec2000 View Post
          Thank you Selwyn for the video.

          The last thing I need to do is activate a button on the grid when it regenerates after the show checked button is clicked. Since the show/hide expression is javascript, I can't seem to set a variable to activate the button since all the code I've written is xbasic.

          any ideas?
          i don't understand the question.

          if you are writing xbasic, then i assume you have a function that is handling an ajax callback?
          if so, the xbasic function generates javascript which it sends back to the browser. this javascript can include the code to set focus to any control on the page.

          Comment


            #6
            Re: Using a checkbox on a grid

            It's probably very simple to do. At the end of the function is this:

            dim cmd as c
            cmd = "{grid.object}.gridFilterSet('" + js_escape(filter) + "');"
            showChecked = cmd


            Is there a way to use this to send multiple lines of javascript like this:

            dim cmd as c
            cmd = "{grid.object}.gridFilterSet('" + js_escape(filter) + "');" + crlf()
            + "var showbutton = 1;"
            showChecked = cmd


            This was my first attempt but I couldn't find out how to do it.

            Comment


              #7
              Re: Using a checkbox on a grid

              Originally posted by leec2000 View Post
              It's probably very simple to do. At the end of the function is this:

              dim cmd as c
              cmd = "{grid.object}.gridFilterSet('" + js_escape(filter) + "');"
              showChecked = cmd


              Is there a way to use this to send multiple lines of javascript like this:

              dim cmd as c
              cmd = "{grid.object}.gridFilterSet('" + js_escape(filter) + "');" + crlf()
              + "var showbutton = 1;"
              showChecked = cmd


              This was my first attempt but I couldn't find out how to do it.
              you are sending back a string that contains javascript code.

              this string can contain as many lines of javascript code as you want. it could contain thousands of lines of javascript if you wanted. there is no limit to the complexity of the javascript that you return.

              so, for example, you could do this in your xbasic:

              dim cmd as c = ""
              cmd = cmd + "alert('message 1');"
              cmd = cmd + "alert('message 2');"
              cmd = cmd + "var x = 1;"
              cmd = cmd + "var y = 2;"
              cmd = cmd + " var z = x + y; alert(z); "

              Comment


                #8
                Re: Using a checkbox on a grid

                Or

                Code:
                dim cmd as c = ""
                
                cmd = <<%str% 
                alert('message 1');
                alert('message 2');
                var x = 1;
                var y = 2;
                var z = x + y; alert(z); 
                %str%
                or this other example of a long JScode

                Code:
                FUNCTION Fn_Reporte_Generar as c (e as p)
                	
                			Reporte = e._currentRowDataNew.char2
                			Nombre = e._currentRowDataNew.char4
                			Filtro_RepActi = e._currentRowDataNew.char3
                			Filtro_RepActi = strtran(Filtro_RepActi,"W"," ")
                			Filtro_RepActi = strtran(Filtro_RepActi,"Z","=")
                			
                			Fn_Reporte_Generar = <<%str%
                			$('Reporte').innerHTML = '<div style=\'cursor:pointer;\' onclick=\'hideFrameDiv__Unbound_Button_1_2_GridFields(); return false;\'><a5:r>Cerrar</a5:r></div><iframe style=\'height: 600px; width: 800px;\'  id=\'IFRAME_Reporte\' src=\'__workingMessage.a5w?message=<a5:r>Generando_Reporte</a5:r>&icon=CSS/A5System/images/wait.gif\'></iframe>'; showFrameDiv__Unbound_Button_1_2_GridFields();
                			//var tbiObjTemp = getTabbedUI();
                			var ro = new Object();
                			ro.reportName = '%str% + Reporte + <<%str%
                			';
                			ro.reportNameShort = '%str% + Nombre + <<%str%
                			';
                			ro.reportType = 'Report';
                			ro.reportIFrame = 'IFRAME_Reporte';
                			ro.filter = '';
                			ro.order = '';
                			ro.sqlFilter = '%str% + Filtro_RepActi + <<%str%
                			';
                			ro.sqlOrder = '';
                			ro.arguments = '';
                			ro.workingMessage = '<a5:r>Generando_Reporte</a5:r>'
                			ro.pdfoptions = 'DIM Concatenate as L\nDIM HasWatermark as L\nDIM MultilingualSupport as L = .T.\nDIM EmbedFonts as L = .T.\nDIM LinearizeForWeb as L\nDIM Colors2GrayScale as L\nDIM ConvertHyperlinks as L = .T.\nDIM WatermarkType as C = `Text`\nDIM WatermarkText as C = `D R A F T`\nDIM WatermarkFontName as C = `Times New Roman`\nDIM WatermarkFontSize as N = 172\nDIM WatermarkRotation as N = 450\nDIM WatermarkColorHex as C = `E8FED2`\nDIM WatermarkHorizPos as N = 120\nDIM WatermarkVertPos as N = -120\nDIM WatermarkOnTop as L\nDIM WatermarkPDF as C\nDIM Encrypt as L\nDIM OwnerPassword as C\nDIM UserPassword as C\nDIM CanPrint as L = .T.\nDIM CanModifyDocument as L = .T.\nDIM CanCopy as L = .T.\nDIM CanAddNotes as L = .T.\nDIM Use128BitKey as L = .T.\nDIM JpegQuality as C = `Medium`\n';
                			ro.displayMode = '';
                			ro.saveAs = 'pdf';
                			ro._gridCurrentFilter = '';
                			ro._gridCurrentOrder = '';
                			ro._gridCurrentArguments = '';
                			ro._gridCurrentDBType = 'sql';
                		
                			A5.component.runReport(ro);
                			%str%
                			'Fn_Reporte_Generar = "alert('"+Reporte+"');"
                	
                END FUNCTION
                Last edited by mmaisterrena; 09-22-2010, 01:49 AM.
                Cheers
                Mauricio

                Comment


                  #9
                  Re: Using a checkbox on a grid

                  I sure appreciate all the help guys but I'm still stuck on this so I want to exlain the objective .

                  If you look at the attachment you will see three action buttons on the bottom. What I need to do is show the first button(Show Checked) by itself when the grid is opened.

                  After the user checks some boxes and presses the first button the grid regenerates showing only checked rows. At this point, only the second button(Print Audit Report) should appear.

                  After the report is printed only the third button(Finish) should appear.

                  In short there should never be more than 1 button on the bottom of the grid.

                  My first thought was just to make it a training issue but the title companies that use this hire a lot of temps and so training must be minimal.

                  I've been trying to use show hide variables but when the grid regenerates they are all reset.

                  I realize that my lack of experience with A5 is showing and that the solution is simple but I've spent all week trying to do this and everything I've tried so far hasn't worked.

                  Any ideas will be appreciated.

                  Comment


                    #10
                    Re: Using a checkbox on a grid

                    To show/hide button, the following script may help:

                    Code:
                    document.getElementById('button1').style.display = 'none';
                    document.getElementById('button1').style.display = 'block';
                    document.getElementById('button1').style.visibility = 'visible';
                    document.getElementById('button1').style.visibility = 'hidden';

                    The returning javascript of Button1 need to do 3 things
                    1) filter the grid
                    2) hide itself
                    3) show Button2

                    Same for returning javascript of Button2
                    1) Print report
                    2) hide itself
                    3) show Button3


                    Code Snippet of xb_button1:
                    Code:
                    function xb_button1 ()
                    ...
                    dim cmd as c
                    cmd = "{grid.object}.gridFilterSet('" + js_escape(filter) + "');" 
                    cmd = cmd  + "document.getElementById('button1').style.visibility = 'hidden';
                     "
                    cmd = cmd  + "document.getElementById('button2').style.visibility = 'visible';
                     "
                    xb_button1 = cmd
                    Norman

                    Comment


                      #11
                      Re: Using a checkbox on a grid

                      Can I show a dialog box like javascript prompt() to let user enter a message and then call the xb function to store the input message into checked rows?

                      For instance.
                      Table field: id, firstname, lastname, salutation.
                      Content
                      1, Norman, Lok , null
                      2, Selwyn, Rabin, null
                      3, Janet, Cook, null
                      etc..

                      User click checkbox of row 1 and 2
                      Click a button, popup a dialog box.
                      User enter [Mr.] (Better to lookup from database table "salute ")
                      click submit button.
                      The xb side will replace [saluation] of row 1,2 with [Mr. Norman Lok] and [Mr. Selwyn Rabin]

                      User click checkbox of row 3
                      Click a button, popup a dialog box.
                      User enter [Miss]
                      click submit button.
                      The xb side will replace [saluation] of row 3 with [Miss Janet Cook].

                      The final table would look like:
                      1, Norman, Lok, Mr. Norman Lok
                      2, Selwyn, Rabin, Mr. Selwyn Rabin
                      3, Janet, Cook, Miss Janet Cook

                      I've using javascript prompt() function to gather user input but it lacks lookup function.

                      So, I build a grid component (enter record form) with lookup.
                      When I use action script to popup the grid component, I don't know how to gather user input inside the popup grid component.

                      Is there any other better method?
                      Norman

                      Comment


                        #12
                        Re: Using a checkbox on a grid

                        Thanks you so much for this. One of the things I've struggled with is going back and forth between xbasic and javascript. This has opened a lot doors for me. Looks like next week will be loads of fun trying all this stuff out.

                        Comment

                        Working...
                        X