PDA

View Full Version : [CLOSED] Edit record on IE



RCN
Feb 06, 2015, 6:28 PM
On the following example, clicking on Clear Age Of First Record button clears the age of the first record.

On IE it shows null
http://forums.ext.net/attachment.php?attachmentid=20561&stc=1

On Chrome it works as expected.
http://forums.ext.net/attachment.php?attachmentid=20571&stc=1

On FireFox it works as expected.
http://forums.ext.net/attachment.php?attachmentid=20581&stc=1



<!DOCTYPE html>
<html>
<head runat="server">
<script type="text/javascript">
var ClearAgeOfFirstRecord = function () {
var recordFromStore = App._str.data.map[1];

recordFromStore.beginEdit();

recordFromStore.data.Age = null;

recordFromStore.endEdit();

recordFromStore.commit();
}
</script>
</head>
<body>
<ext:ResourceManager runat="server" />
<ext:GridPanel Title="Ext.Net" Border="true" Width="500" Height="400" runat="server">
<Store>
<ext:Store ID="_str" AutoLoad="true" runat="server">
<Proxy>
<ext:AjaxProxy Url="~/Example/LoadFakeRecords/">
<ActionMethods Read="POST" />
<Reader>
<ext:JsonReader RootProperty="data" />
</Reader>
</ext:AjaxProxy>
</Proxy>
<Model>
<ext:Model IDProperty="ID" runat="server">
<Fields>
<ext:ModelField Name="ID" Type="String" />
<ext:ModelField Name="Name" Type="String" />
<ext:ModelField Name="Age" AllowNull="true" />
</Fields>
</ext:Model>
</Model>
</ext:Store>
</Store>
<ColumnModel runat="server">
<Columns>
<ext:Column Text="ID" DataIndex="ID" runat="server" />
<ext:Column Text="Name" Flex="1" DataIndex="Name" runat="server" />
<ext:Column Text="Age" DataIndex="Age" runat="server" />
</Columns>
</ColumnModel>
<Buttons>
<ext:Button Text="Clear Age Of First Record" runat="server">
<Listeners>
<Click Handler="ClearAgeOfFirstRecord();" />
</Listeners>
</ext:Button>
</Buttons>
</ext:GridPanel>
</body>
</html>



namespace SandBox.Controllers
{
public class ExampleController : System.Web.Mvc.Controller
{
public ActionResult Index()
{
return View();
}

public StoreResult LoadFakeRecords()
{
List<Entity> lst = new List<Entity>();

for (int index = 1; index < 16; index++)
{
lst.Add(new Entity
{
ID = index,
Name = string.Format("Name - {0}", index),
Age = index
});
}

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

[Serializable]
public class Entity
{
public int ID { get; set; }

public string Name { get; set; }

public Nullable<int> Age { get; set; }
}
}

Daniil
Feb 10, 2015, 1:13 PM
Hi Raphael,

An interesting issue. This example demonstrates what happens internally.

Example

<%@ Page Language="C#" %>

<!DOCTYPE html>

<html>
<head runat="server">
<title>Ext.NET v3 Example</title>
</head>
<body>
<form runat="server">
<ext:ResourceManager runat="server" />

<ext:Button runat="server" Text="Test" Handler="div1.innerHTML = null;" />

<p>Test div:</p>
<div id="div1"></div>
</form>
</body>
</html>

It behaves the same. IE - "null" appears, Firefox and Chrome - nothing appears.

As a workaround I can suggest to use this Renderer for a Column:

<Renderer Handler="return value;" />

Using a Renderer changes the rendering process a little bit and there is no a direct set of innerHTML.

RCN
Feb 10, 2015, 1:22 PM
Thank you Daniil. I will review.