PDA

View Full Version : [CLOSED] click over cell mark edited in gridPanel?



aditya
Nov 13, 2013, 10:19 AM
hi,
i have a grid in which when i click and get out without changing data over a cell (editable cell & clickToEdit = "1") which containing null/empty data sets edited (red corner mark). how to stop it?

Daniil
Nov 13, 2013, 12:15 PM
Hi @aditya,

Specifying Type for a ModelField can help. Please see an example.

The first Column reproduces the behavior you are talking about, but the second one doesn't.

Example

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

<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>

<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
if (!X.IsAjaxRequest)
{
Store store = this.GridPanel1.GetStore();
store.DataSource = new object[]
{
new object[] { null, "test" },
new object[] { null, null },
new object[] { "test", null }
};
}
}

protected void TestDirectEventHandler(object sender, DirectEventArgs e)
{
X.Msg.Alert("DirectEvent", "Hello from Server!").Show();
}
</script>

<!DOCTYPE html>

<html>
<head runat="server">
<title>Ext.NET v2 Example</title>
</head>
<body>
<form runat="server">
<ext:ResourceManager runat="server" />
<ext:GridPanel ID="GridPanel1" runat="server">
<Store>
<ext:Store runat="server">
<Model>
<ext:Model runat="server">
<Fields>
<ext:ModelField Name="test1" />
<ext:ModelField Name="test2" Type="String" />
</Fields>
</ext:Model>
</Model>
</ext:Store>
</Store>
<ColumnModel runat="server">
<Columns>
<ext:Column runat="server" Text="Test 1" DataIndex="test1">
<Editor>
<ext:TextField runat="server" />
</Editor>
</ext:Column>
<ext:Column runat="server" Text="Test 2" DataIndex="test2">
<Editor>
<ext:TextField runat="server" />
</Editor>
</ext:Column>
</Columns>
</ColumnModel>
<Plugins>
<ext:CellEditing runat="server" ClicksToEdit="1" />
</Plugins>
</ext:GridPanel>
</form>
</body>
</html>

aditya
Nov 13, 2013, 12:32 PM
thanks a lot @Daniil,
it works. sorry for taking your valuable time for this small issue. i am new in ext.net. you can close it now.

Daniil
Nov 13, 2013, 12:42 PM
I would say it is not so simple issue.

Anyway, we are always glad to help!