[CLOSED] Column visibility

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1

    [CLOSED] Column visibility

    I have page with Grid. All data for grid (column model etc) added in cs code. For some columns set visibility to false. I need to make this columns visible using javascript. There no this columns in Grid.Columns property.
    Where I could find this columns and how to make them visible? Or Should I make them visible by default and set visibility to false in Grid AfterRender?
    Last edited by Daniil; Jul 18, 2013 at 12:20 PM. Reason: [CLOSED]
  2. #2
    Try to use Column's Hide method.
  3. #3
    Quote Originally Posted by RCN View Post
    Try to use Column's Hide method.
    Columns already invisible. I need to make them visible.
  4. #4
    So, try to use Column's show method.
  5. #5
    Hi,

    I guess you are using the Visible property, aren't you? I think it is better to use the Hidden one. The difference is explained here:
    http://forums.ext.net/showthread.php?13114#post54033

    Then you will be able to show such a Column by the show method call as Raphael suggested.
  6. #6
    Please, take a look on the following example:

    <!DOCTYPE html>
    <html>
    <head id="Head1" runat="server">
        <script type="text/javascript">
            var hide = function () {
                App._grd.columns[1].hide();
            }
            var show = function () {
                App._grd.columns[1].show();
            }
        </script>
    </head>
    <body>
        <ext:ResourceManager runat="server" />
        <ext:Button Text="HIDE Second Column" runat="server">
            <Listeners>
                <Click Handler="hide();" />
            </Listeners>
        </ext:Button>
        <ext:Button Text="SHOW Second Column" runat="server">
            <Listeners>
                <Click Handler="show();" />
            </Listeners>
        </ext:Button>
        <ext:GridPanel ID="_grd" runat="server" Title="Records" Frame="false" Width="500" Height="500">
            <Store>
                <ext:Store runat="server">
                    <Proxy>
                        <ext:AjaxProxy Url="/Example/LoadFakeRecords/">
                            <ActionMethods Read="POST" />
                            <Reader>
                                <ext:JsonReader Root="data" />
                            </Reader>
                        </ext:AjaxProxy>
                    </Proxy>
                    <Model>
                        <ext:Model runat="server">
                            <Fields>
                                <ext:ModelField Name="ID" Type="String" />
                                <ext:ModelField Name="Name" Type="String" />
                                <ext:ModelField Name="Address" Type="String" />
                            </Fields>
                        </ext:Model>
                    </Model>
                </ext:Store>
            </Store>
            <ColumnModel runat="server">
                <Columns>
                    <ext:Column Text="ID" DataIndex="ID" runat="server" />
                    <ext:Column Text="Name" DataIndex="Name" runat="server" />
                    <ext:Column Text="Address" DataIndex="Address" runat="server" />
                </Columns>
            </ColumnModel>
        </ext:GridPanel>
    </body>
    </html>
    namespace SandBox.Controllers
    {
        public class ExampleController : System.Web.Mvc.Controller
        {
            public ActionResult Index()
            {
                return View();
            }
    
            public StoreResult LoadFakeRecords()
            {
                List<Person> lst = new List<Person>();
    
                for (int index = 0; index < 15; index++)
                {
                    lst.Add(new Person
                    {
                        ID = index,
                        Name = "Name" + index,
                        Address = "Address" + index,
                    });
                }
    
                return new StoreResult(lst, lst.Count());
            }
        }
    
        [Serializable]
        public sealed class Person
        {
            public int ID { get; set; }
    
            public string Name { get; set; }
    
            public string Address { get; set; }
        }
    }


    I would also recommend you to take a look on the following thread: http://forums.ext.net/showthread.php...ing-JavaScript
  7. #7
    Quote Originally Posted by Daniil View Post
    Hi,

    I guess you are using the Visible property, aren't you? I think it is better to use the Hidden one. The difference is explained here:
    http://forums.ext.net/showthread.php?13114#post54033

    Then you will be able to show such a Column by the show method call as Raphael suggested.
    You was right. I used Visible property. I am using hidden right now. Thanks for help. You can close this thread.

Similar Threads

  1. GridPanel visibility
    By AlexMaslakov in forum 1.x Help
    Replies: 5
    Last Post: Aug 17, 2011, 12:56 PM
  2. [FIXED] [0.8.2] BoxLabel Visibility
    By Timothy in forum Bugs
    Replies: 7
    Last Post: Oct 08, 2009, 11:51 PM
  3. Replies: 2
    Last Post: Jul 30, 2009, 3:04 PM
  4. [FIXED] [V0.8.0] TabPanel Visibility Bug
    By Timothy in forum Bugs
    Replies: 4
    Last Post: Jan 26, 2009, 12:20 PM
  5. [FIXED] [V0.7] Visibility Bug
    By Timothy in forum Bugs
    Replies: 2
    Last Post: Nov 05, 2008, 9:48 AM

Tags for this Thread

Posting Permissions