Originally Posted by
Daniil
Sencha has opened a bug.
Originally Posted by
Daniil
Regarding Editor RemoteValidation.
Generally, RemoteValidation was not designed to use for the Editor. Though, I think, there is a good chance to get it working. We will look.
Since RowEditing (and, internally, RowEditor) does know nothing about remote validation, I can suggest the following solution:
<RemoteValidation
Url="/Test/CheckField"
Complete="App.GridPanel1.editingPlugin.getEditor().onFieldChange();" />
to get the RowEditing knowing about that. Though, sure, if you would like to avoid re-working RowEditing/RowEditor to support remote validation:)
Another thing that I have discovered one bug more. It is related to:
Originally Posted by
adelaney
For a little more info to the above post, the button appears enabled, but it is not clickable until the validation error is cleared.
Here is a workaround:
<ext:RowEditing runat="server" ClicksToEdit="1" ErrorSummary="false">
<Listeners>
<BeforeEdit Handler="this.getEditor().onFieldChange();" Delay="100" />
</Listeners>
</ext:RowEditing>
and the bug report to Sencha:
http://www.sencha.com/forum/showthread.php?232876
Here is the full example which appears to be working correctly.
Example View
<%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage" %>
<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<!DOCTYPE html>
<html>
<head runat="server">
<title>Ext.Net.MVC v2 Example</title>
</head>
<body>
<ext:ResourceManager runat="server" />
<ext:GridPanel ID="GridPanel1" runat="server" Height="200">
<Store>
<ext:Store runat="server">
<Model>
<ext:Model runat="server">
<Fields>
<ext:ModelField Name="test1" />
<ext:ModelField Name="test2" />
<ext:ModelField Name="test3" />
</Fields>
</ext:Model>
</Model>
<Proxy>
<ext:AjaxProxy Url="/Test/GetData">
<Reader>
<ext:ArrayReader Root="data" />
</Reader>
</ext:AjaxProxy>
</Proxy>
</ext:Store>
</Store>
<ColumnModel runat="server">
<Columns>
<ext:Column runat="server" Text="Test1" DataIndex="test1" />
<ext:Column runat="server" Text="Test2" DataIndex="test2">
<Editor>
<ext:TextField runat="server" AllowBlank="false" IsRemoteValidation="true">
<RemoteValidation
Url="/Test/CheckField"
Complete="App.GridPanel1.editingPlugin.getEditor().onFieldChange();" /> <%-- To get the RowEditing know about remote validtion --%>
</ext:TextField>
</Editor>
</ext:Column>
<ext:Column runat="server" Text="Test3" DataIndex="test3" />
</Columns>
</ColumnModel>
<Plugins>
<ext:RowEditing runat="server" ClicksToEdit="1" ErrorSummary="false">
<Listeners>
<%-- Workaround to get correct initial disabled/enabled state of the Update button --%>
<BeforeEdit Handler="this.getEditor().onFieldChange();" Delay="100" />
</Listeners>
</ext:RowEditing>
</Plugins>
</ext:GridPanel>
</body>
</html>
Example Controller Actions
public ActionResult GetData()
{
StoreResult r = new StoreResult();
r.Data = new object[]
{
new object[] { "test1", "test2", "test3" },
new object[] { "test4", "", "test6" },
new object[] { "test7", "test8", "test9" },
};
return r;
}
public ContentResult CheckField(string id, string value)
{
bool success = value == "Valid";
object r = new
{
valid = success,
message = success ? "" : "'Valid' is valid value only"
};
return Content(JSON.Serialize(r), "application/json");
}