PDA

View Full Version : [CLOSED] Unable to lock grid view column



RCN
Nov 26, 2012, 1:05 PM
When the grid does not have an initial locked column, its not possible lock an column anymore.

Run the following example and try to lock Column1. To make it work it's necessary to set locked to true on View's line 38

1 - View


<!DOCTYPE html>
<html>
<head runat="server">
<title>Index</title>
</head>
<body>
<ext:ResourceManager ID="ResourceManager1" runat="server" />
<ext:Panel ID="Panel1" Margin="10" Header="false" runat="server">
<Items>
<ext:GridPanel ID="GridPanel1" runat="server" Title="Records" Frame="false" Width="300">
<Store>
<ext:Store runat="server" ID="Store2">
<Proxy>
<ext:AjaxProxy Url="/Example/LoadFakeRecords/">
<ActionMethods Read="POST" />
<Reader>
<ext:JsonReader Root="data" />
</Reader>
</ext:AjaxProxy>
</Proxy>
<Model>
<ext:Model ID="Model2" 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>
<Sorters>
<ext:DataSorter Property="Common" Direction="ASC" />
</Sorters>
</ext:Store>
</Store>
<ColumnModel ID="ColumnModel1" runat="server">
<Columns>
<ext:RowNumbererColumn ID="RowNumbererColumn1" runat="server" />
<ext:Column ID="Column1" runat="server" Text="ID" DataIndex="ID" Lockable="true" />
<ext:Column ID="Column3" runat="server" Text="Name" DataIndex="Name" />
<ext:Column ID="Column2" runat="server" Text="Address" DataIndex="Address" />
</Columns>
</ColumnModel>
</ext:GridPanel>
</Items>
</ext:Panel>
</body>
</html>


2 - Controller


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


3 - Utility



public class Person
{
public int ID { get; set; }

public string Name { get; set; }

public string Address { get; set; }
}

Daniil
Nov 26, 2012, 4:45 PM
Hi Raphael,

I think it needs to set up EnableLocking="true" for the GridPanel.

Just Locked="true" enables it automatically, but Lockable="true" does not.

RCN
Nov 26, 2012, 6:21 PM
Thank you Danill, please mark it as closed.