PDA

View Full Version : [CLOSED] Align only Column's content



RCN
Oct 02, 2013, 2:07 PM
Hi, i would like to know whether there is a "built-in" property to align only column's content as shown below:

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; }
}
}

Daniil
Oct 02, 2013, 4:50 PM
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.

RCN
Oct 02, 2013, 7:14 PM
Thank you Daniil. Please mark this thread as closed.