PDA

View Full Version : [CLOSED] Commit CheckColumn editing during BeforeEdit event



RCN
Jun 06, 2013, 9:56 PM
After updating from SVN i found an issue regarding the CheckColumn. If i commit the record editing during BeforeEdit, the column remains under editing.



<!DOCTYPE html>
<html>
<head id="Head1" runat="server">
<script type="text/javascript">
var BeforeEdit = function (item, e) {
e.record.commit();
e.record.endEdit();
}
</script>
</head>
<body>
<ext:ResourceManager runat="server" />
<ext:GridPanel runat="server" Title="Records" Frame="false"
Width="500" Height="500">
<Store>
<ext:Store 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="Active" Type="Boolean" />
</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:CheckColumn Text="Active" DataIndex="Active" Editable="true" runat="server" />
</Columns>
</ColumnModel>
<Listeners>
<BeforeEdit Handler="BeforeEdit(item, e);" />
</Listeners>
</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,
Active = index % 2 == 0
});
}

return new StoreResult(lst, lst.Count());
}
}

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

public string Name { get; set; }

public bool Active { get; set; }
}
}

Baidaly
Jun 07, 2013, 4:18 AM
Hello!

Thank you! We are investigating.

Daniil
Jun 07, 2013, 6:42 AM
Hi Raphael,


the column remains under editing.

Do you mean that those call doesn't prevent editing? Well, to prevent editing please return false from a BeforeEdit listener or set up "e.cancel = true;".

It looks weird for me to call a record's commit and endEdit methods within a BeforeEdit listener. Is it just to prevent editing?