[CLOSED] Align only Column's content

  1. #1

    [CLOSED] Align only Column's content

    Hi, i would like to know whether there is a "built-in" property to align only column's content as shown below:

    Click image for larger version. 

Name:	0123.png 
Views:	12 
Size:	59.1 KB 
ID:	6977

    It's possible to accomplish it by setting column's Align property, and then, "reset" Header align, as shown below:

    <!DOCTYPE html>
    <html>
    <head id="Head1" runat="server">
        <style type="text/css">
            .fixHeaderAlign .x-column-header-inner {
                text-align: left !important;
                color: red;
            }
        </style>
    </head>
    <body>
        <ext:ResourceManager runat="server" />
        <ext:GridPanel runat="server" Title="Records" Frame="false" Width="500" Height="500">
            <Store>
                <ext:Store AutoLoad="true" ID="_str" 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" Cls="fixHeaderAlign" Align="Right" runat="server" />
                    <ext:Column Text="Name" DataIndex="Name" runat="server" />
                </Columns>
            </ColumnModel>
        </ext:GridPanel>
    </body>
    </html>
    namespace RCNBS.Visions.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
                    });
                }
    
                return new StoreResult(lst, lst.Count());
            }
        }
    
        public class Person
        {
            public int ID { get; set; }
    
            public string Name { get; set; }
        }
    }
    Last edited by Baidaly; Oct 02, 2013 at 10:08 PM. Reason: [CLOSED]
  2. #2
    Hi Raphael,

    No, there is no such a property.

    Your solution is good enough. Though, I would try to avoid an "!important" thing if possible.
  3. #3
    Thank you Daniil. Please mark this thread as closed.

Similar Threads

  1. [CLOSED] How to align GridPanel Headings differently than column content
    By SFritsche in forum 2.x Legacy Premium Help
    Replies: 4
    Last Post: Dec 11, 2012, 12:51 AM
  2. Replies: 1
    Last Post: Nov 04, 2011, 8:51 AM
  3. Replies: 5
    Last Post: Jul 28, 2011, 6:30 PM
  4. Align content in gridpanel
    By teo80 in forum 1.x Help
    Replies: 4
    Last Post: Jul 25, 2011, 12:24 PM
  5. [CLOSED] [1.0] GridPanel Column Vertical Align
    By Timothy in forum 1.x Legacy Premium Help
    Replies: 6
    Last Post: Apr 12, 2010, 9:37 AM

Posting Permissions