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

Hiding Columns in a Grid

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

    Hiding Columns in a Grid

    Hi All

    I have looked at what seems like thousands of post but cannot find what I want.


    My issue is the following.

    I have a grid which has 10 columns but I do not always want to show all of them based on what a field called alignment has in it.

    eg.

    If alignment = 1 show columns 1-4
    If alignment = 2 show columns 5-8
    If alignment = 3 show columns 9-10


    I think I need to use the OnGridInitialize event but I am not sure if that is correct and if it is what would the code look like.

    Any help appreciated.

    Thanks

    Chris

    #2
    Re: Hiding Columns in a Grid

    Have a look here, Chris... http://www.youtube.com/watch?v=6gAenGcSiTg

    You can use the Grid method showGridColumn to show/hide columns.

    I'm using the onGridRenderComplete event to call a Javascript function. The function shows and hide columns based on the Alignment value.

    I'm also calling the same function from the onChange event of the Alignment field to illustrate the effect.

    Comment


      #3
      Re: Hiding Columns in a Grid

      all you have to do is,

      oops sorry wrong forum

      Comment


        #4
        Re: Hiding Columns in a Grid

        David

        Thank you for the video - I really appreciate it and it worked fantastically well.

        The only other issues that I have are I am using a fixed grid and I have a column spacer to keep the grid a standard size. When I use this method the column spacer is set at 378px and seems to be ignored. Is there anything I can do about that?

        Thanks for you time

        Chris

        Comment


          #5
          Re: Hiding Columns in a Grid

          Hi David

          I have just setup dummy space fields in the view which I can turn on and off as I like to preserve the grid width.

          The problem I now have is that it seems that if you have a fixed grid and turn the columns on and off it ignores the sizes of the columns that are setup. It just uses the default size set for the columns. Is there a way of setting the column size in the javascript method above.

          Thanks

          Chris

          Comment


            #6
            Re: Hiding Columns in a Grid

            Hey Chris,

            The challenge with this stuff is that there are so many options and properties I don't know how to duplicate what you've got. Walk me through setting up a "fixed grid" with a "column spacer" the way you have it set up. Then let me know how you added "dummy space fields in the view". Then I'll be able to duplicate your grid setup and see how to change it in code. Thanks.

            Comment


              #7
              Re: Hiding Columns in a Grid

              David

              The 2 Options that I have used are:-

              Fixed Grid Width 900px

              Column Spacer Method

              Student_Id 30px
              Forename 100px;
              Surname 100px;
              Grade A 40px;
              Grade B 40px;
              Grade C 40px;
              Grade D 40px;
              Grade E 40px;

              [Column].1 Spacer from Alpha Fields is set to 470px in the Field Properties This pads out the Grid to 900px


              Dummy Fields
              Student_Id 30px
              Forename 100px;
              Surname 100px;
              Grade A 40px;
              Grade B 40px;
              Grade C 40px;
              Grade D 40px;
              Grade E 40px;
              Space 470px

              The only difference between the 2 is that in 1 I use the column spacer from Alpha whereas in option 2 I just pass over a field called space from the SQL Table.

              Does that make sense?

              Chris

              Comment


                #8
                Re: Hiding Columns in a Grid

                Hey Chris,

                I don't think you want to go the SQL dummy field route... that sounds a little complicated to me. Instead here's a good way to maintain your Grid width at 900px while displaying your variable number of fields.

                The video explains it, but what you want to to is add a "dummy" field. From the Insert hyperlink, add a Static Text field. In it's Cell in-line style put width:10px; just for the heck of it.

                Looking at the grid running under Chrome or FireFox you can inspect this dummy control and this control will have an ID of...

                Code:
                GRID1.TD.R1._UNBOUND_STATICTEXT_1
                Since it has an ID, we can change it's width.

                In your Javascript routine that shows and hides the columns, add one more line to each block of show/hide code...

                Code:
                $('{Grid.ComponentName}.TD.R1._UNBOUND_STATICTEXT_1').style.width="550px";
                For each block, you will add up the the size of the columns that are showing... subtract that amount from 900... and that will give you your space padding amount for that block which you'll enter into the style.width setting.

                http://www.youtube.com/watch?v=W-iRgEJPMz8

                Comment


                  #9
                  Re: Hiding Columns in a Grid

                  David

                  Thank you for the Video - that is a much better method - I have entered the code but the function seems to be just ignored and all the components are shown and not hidden and they are their original size.

                  Can you see any issues with the code below.

                  function showHideColumns(){

                  var rowNum = {grid.Object}._selectedRow;
                  var currAlign = {grid.Object}.getValue('G','ALIGNMENT',rowNum);
                  switch (currAlign)
                  {

                  case '1':
                  {grid.Object}.showGridColumn("SURNAME",true);
                  {grid.Object}.showGridColumn("CHOSEN_FORENAME",true);
                  {grid.Object}.showGridColumn("GENDER",true);
                  {grid.Object}.showGridColumn("TG",true)
                  {grid.Object}.showGridColumn("SEVEN_P",true);
                  {grid.Object}.showGridColumn("EIGHT_P",true);
                  {grid.Object}.showGridColumn("NINE_P",true);
                  {grid.Object}.showGridColumn("EG_FOUR_LOP",true);
                  {grid.Object}.showGridColumn("MA_FOUR_LOP",false);
                  {grid.Object}.showGridColumn("GCSE_P",false);
                  {grid.Object}.showGridColumn("AS_P",false);
                  {grid.Object}.showGridColumn("AS_P_PLUS_1",false);
                  {grid.Object}.showGridColumn("A2_P",false);
                  {grid.Object}.showGridColumn("A2_P_PLUS_1",false);
                  $('{Grid.ComponentName}.TD.R1._UNBOUND_STATICTEXT_1').style.width="378px";
                  $('{Grid.ComponentName}.TD.R1._UNBOUND_BUTTON_1').style.width="80px";
                  break;

                  Thanks

                  Chris

                  Comment


                    #10
                    Re: Hiding Columns in a Grid

                    David

                    There was a javascript error which I have now solved and the correct fields are now being showing depending on the alignment flag.

                    The issue is that the static text isn't resizing and the button is always 40px which is the default column width that I have set for the scrolling grid.

                    Any ideas.

                    Thanks

                    Chris

                    Comment


                      #11
                      Re: Hiding Columns in a Grid

                      Chris,

                      How you are setting a Fixed Grid Width 900px? Are you calling this Grid from somewhere and setting the width there? Something's missing.

                      Comment


                        #12
                        Re: Hiding Columns in a Grid

                        David

                        I am using a tabbedUI.

                        I have a button on a Grid that loads the Grid above into another tabbedUI using Java Action Script.

                        That Grid is Fixed Size within the Grid Properties Colomns and Sorting/Scrolling Options -Grid Body can Scroll.

                        The Column Widths are also set in there.

                        I agree something is missing - it is as though the fields aren't being addressed for some reason.

                        Chris

                        Comment


                          #13
                          Re: Hiding Columns in a Grid

                          Yup... that's what I thought... that's the missing piece.

                          So you have TabbedUI_1, with a Grid. You hit a button on that Grid and launch TabbedUI_2 containing the Grid you want to have fixed columns.

                          Is it a 2nd TabbedUI... or another pane in TabbedUI_1?

                          Comment


                            #14
                            Re: Hiding Columns in a Grid

                            Hi David

                            It launches another pane within the same TabbedUI.

                            Comment


                              #15
                              Re: Hiding Columns in a Grid

                              It's doesn't look like it really matters how the grid is being called... although it's nice to know the details so problems can be reproduced under the same conditions. The rendered static text control, in a grid, called from a grid, residing in a TabbedUI is...

                              Code:
                              TBI_GRD_CALL_F_11345EJWQ_GRD_HIDE_C_BHKWARGENTINA.TD.R1._UNBOUND_STATICTEXT_1
                              When you reference that control in code...

                              Code:
                              {Grid.ComponentName}.TD.R1._UNBOUND_STATICTEXT_1
                              then {Grid.ComponentName} is swapped out for the tabbed ui alias and all is good. That's one of the reasons why Alpha provides {Grid.ComponentName} because you never know where it's going to be rendered.

                              My static text control width is being changed by my Javascript code as I change my Alignment #.

                              I have the static text control listed in the column widths of the fixed column width section.

                              Comment

                              Working...
                              X