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

How can I hide a grid column

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

    How can I hide a grid column

    Hi,

    I've searched the forums and found bits of info but I'm hoping someone can help me to hide a grid column if there is no data in it.

    I have a grid with 10 columns of data and there are times when there is only a few colums that actually contain data, depending on the search filters used. I want tidy up the grid by only displaying those colums that actually have some data in and hiding those with no data. I've tried to figure out how to do this with the show / hide function but can't seem to get anywhere.

    Can someone point me in the right direction ?

    Thanks

    #2
    Re: How can I hide a grid column

    There's a Hide Column field property that will hide the column completely. The Show/Hide will show and hide the data itself in the column. Are you talking about hiding Column headings when there's no data in the rows? That's more complicated and past my know-how, though I'm sure it can be done.

    Comment


      #3
      Re: How can I hide a grid column

      Hi,

      I want to hide the column completely if there is no data but it needs to be dynamic i.e. the column will be displayed if there is data but not if there isn't.

      Comment


        #4
        Re: How can I hide a grid column

        I think you should be able to use in the show/hide properties
        I may have the syntax wrong but look it up in wiki if you need to its an xbasic function.

        Basically means if the field has 1 or more characters it should show.

        len("fieldname")>0
        Chad Brown

        Comment


          #5
          Re: How can I hide a grid column

          Not sure this makes sense.
          You want to hide the COLUMN if any of the rows for that column have empty data? :s


          If you hide the column - you wont be able to see the data for that column in any rows that have data for that column.

          You can probably use the OnExistingRowsRender to keep track of your vars

          dim col1count as N
          dim col2count as N
          dim col3count as N

          if data.col1<>"" then
          col1count=col1count+1;
          end if


          then youd have to store these counts in session.
          then you could use the AfterExistingRowsRender to look at the counts and call
          e.tmpl.fieldinfo[x].Column.Hide=.t. (or something lik ethat - i forgot)

          and then you have to set a certain override variable (take a look at grid overrides) its something like recompileGridAtRunTime...youll have to set this to true

          Im not sure theres an easy way to do what you wanna do. If there are lots of null columns in your db - you may want to look at setting the table up as an eav table (entity attribute value) instead of a normal relational table.

          e.g In a situation liek the following (clinical data) - it doesnt make sense to have a ton of columns 1 for cancer diagnosis, 1 for rolly polly, 1 for Recommendations, 1 for disease 1-x where x is infinite.

          Clinical Data Table
          person_id
          attribute
          value


          1, "Cancer Diagnosis", "No signs were found in this particular case"
          1, "Rolly Polly Olly Diagnosis", "Signs of minimal infection, cured, patient feeling better"
          1, "Recommendations", "Revisit after a week"
          2, "Initial Meeting", "Patient complained about chest pain"
          Last edited by aburningflame; 11-30-2010, 08:07 PM.
          Scott Moniz - Computer Programmer/Analyst
          REA Inc.
          http://reainc.net
          (416)-533-3777
          [email protected]

          REA INC offers consulting services, programming services, systems design, database design, third party payment gateway integration (CHASE, PAYPAL, AUTHORIZE.NET) and developer support.
          If you need custom code, or 1-to-1 mentoring in any facet of your database/web application design,
          contact us to discuss options.

          Comment


            #6
            Re: How can I hide a grid column

            Don't know if this is a good way of approaching this but I have has a go with javascript. This example is for a single column in a dbf grid.

            Place the following code in the afterSearchSubmit event:

            Code:
            // Set the variables
            var checktest='false';
            var ele='';
            
            
            // Check for any data in search results for the column
            for (var i=1; i<={grid.object}._rowsInGrid; i++) {
            
            	ele = $('{grid.componentName}.V.R'+i+'.COLUMN_NAME');
            
            	if ($gvs(ele) !='') {
            	checktest='true';
            	break;	
            	}
            }
            
            
            // Show or Hide the Column
            if (checktest=='false') {
            	{grid.object}.showGridColumn('COLUMN_NAME',false);
            	}
            	else {
            	{grid.object}.showGridColumn('COLUMN_NAME',true);
            	}

            Place the following code in the afterSearchClear event:

            Code:
            {grid.object}.showGridColumn('COLUMN_NAME',true);

            Comment


              #7
              Re: How can I hide a grid column

              http://www.ajaxvideotutorials.com/V1...deShowHide.swf

              Comment


                #8
                Re: How can I hide a grid column

                That is great, but it only appears to work if the grid layout is in "form" (columnar) mode.

                Can this be done if the grid layout is in the tabular mode?

                I have a grid in tabular mode and I'd like to have a column show or hide depending on the session variable of a logged in user.

                In the attached pic, I want to show/hide the column called "Parking Cit Location."

                BTW, I know how to "show/hide" the control itself using the client side javascript genie, but that doesn't remove the column heading. I want to remove both, which I assume is the same thing as show/hiding the entire column, I just don't see an option to do that in the field properties.
                Sergeant Richard Hartnett
                Hyattsville City Police Department
                Maryland

                Comment


                  #9
                  Re: How can I hide a grid column

                  Much easier to set the security setting (of the logged in user) and let it handle it as a security group issue that's what it really for after all. Why not give that a go - set up a group ViewParking.
                  Insanity: doing the same thing over and over again and expecting different results.
                  Albert Einstein, (attributed)
                  US (German-born) physicist (1879 - 1955)

                  Comment


                    #10
                    Re: How can I hide a grid column

                    Holy cow Pete, that was SUPER easy!!

                    It's interesting that I've never used that ability to select security groups on individual components in the past because I could never think of a reason to. As such, I plain forgot that option was available.

                    Man that is great. It works like a charm, and opens up worlds of new options for me in my police records management application.

                    As always, thanks a bunch Pete.

                    I couldn't survive without the expert help on this forum!
                    Sergeant Richard Hartnett
                    Hyattsville City Police Department
                    Maryland

                    Comment


                      #11
                      Re: How can I hide a grid column

                      That's OK Rich - the product is so rich with functionality these days it's easy to miss the classic solutions. After all the well worn path in a journey is worn for a reason - you know it will get you there.
                      Insanity: doing the same thing over and over again and expecting different results.
                      Albert Einstein, (attributed)
                      US (German-born) physicist (1879 - 1955)

                      Comment


                        #12
                        Re: How can I hide a grid column

                        Well Pete my elation was short-lived.

                        While the security group setting per field does work to hide the column from users not selected in the authorized group, it also causes an error whenever data is inserted into one of "other" fields.

                        The field I have chosen to hide is called "PARKINGCITLOCATION." If it is viewable on the screen (authorized user) everything is fine. But, if it is hidden from the screen because the user was not in the authorized security group, I get the following message upon submitting data in one of the other fields:

                        Fatal error running a5_ajax_grid(): Property not found grid.grid_part.dropdownboxchoices.PARKINGCITLOCATION subelement not found.

                        During experimentation, it appears that this only happens if the field uses a drop-down control, which unfortunately is what I need in this situation.

                        Maybe you could give it a test on one of your grids to see if you experience the same problem? If so, I may have to submit a bug report.
                        Sergeant Richard Hartnett
                        Hyattsville City Police Department
                        Maryland

                        Comment


                          #13
                          Re: How can I hide a grid column

                          Change it to a text box lookup edit combo - i'd say that will work - the error is a bug so you best report it.
                          Insanity: doing the same thing over and over again and expecting different results.
                          Albert Einstein, (attributed)
                          US (German-born) physicist (1879 - 1955)

                          Comment


                            #14
                            Re: How can I hide a grid column

                            Tried that, but it has its own set of problems.

                            If I use the text box lookup edit combo and then hide it via the security framework, the "submit" button becomes disabled.

                            The minute I remove the security function, the submit button works again.

                            Very weird.

                            Anyway, I will send in a bug report. If they can get it fixed, it will work wonders for my application.

                            Thanks Pete.
                            Sergeant Richard Hartnett
                            Hyattsville City Police Department
                            Maryland

                            Comment


                              #15
                              Re: How can I hide a grid column

                              UPDATE -

                              I sent in a bug report last night, and this afternoon Selwyn had the problem fixed! (Both the regular drop-down and the text box-edit/combo type drop-down)

                              The fix will be in the next patch, but if anyone needs it earlier, let me know and I can forward it to you.

                              Rich
                              Sergeant Richard Hartnett
                              Hyattsville City Police Department
                              Maryland

                              Comment

                              Working...
                              X