PDA

View Full Version : [CLOSED] GridPanel Column Editor PLUGIN: disable Enter KEY on default button Update and Cancel'



tanky65
Jun 21, 2013, 2:05 PM
Hi again,

I couldn't get the following simple example to work after adding Daniil suggestion about whole disabling of the enter key adding AfterRender Handler.




<Listeners>
<AfterRender Handler="this.editingPlugin.editor.on('afterrender', function () {
Ext.Array.erase(this.keyNav.map.bindings, 0, 1);
});" Delay="1" />
</Listeners>


After many tests I found that it works only if at least one column has the Flex attribute set. (???) Why??
Can you explain me why ? I wouldn't want to set one column flex because the fields are few and the flex field will fill the whole remaining space appearing ugly to handle, overall if it is a combo.

try to test it in explorer 10, defining aand then exlcuding the Flex property on the column Email and you get the error
Error: Unable to get property 'on' of undefined or null reference

it doesn't recognize the editorplugin (not yet instantited..)

thanks in advance



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

<%@ Import Namespace="System.Collections.ObjectModel" %>
<%@ Import Namespace="System.Collections.Generic" %>
<%@ 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 List<object>
{
new {
Name = "Bill Foot",
Email = "bill.foot@object.net"
},
new {
Name = "Bill Little",
Email = "bill.little@object.net"
}
};

store.DataBind();
}
}
</script>
<!DOCTYPE html>
<html>
<head id="Head1" runat="server">
<title>GridPanel with RowEditor Plugin - Ext.NET Examples</title>
<link href="/resources/css/examples.css" rel="stylesheet" />
</head>
<body>
<form id="Form1" runat="server">
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<ext:ResourceManager ID="ResourceManager1" runat="server" />
<ext:Store ID="Store1" runat="server">
<Model>
<ext:Model ID="Model1" runat="server" Name="Employee" IDProperty="name">
<Fields>
<ext:ModelField Name="name" ServerMapping="Name" Type="String" />
<ext:ModelField Name="email" ServerMapping="Email" Type="String" />
</Fields>
</ext:Model>
</Model>
</ext:Store>
<ext:GridPanel ID="GridPanel1" StoreID="Store1" runat="server" Width="600" Height="400"
Frame="true" Title="Employees">
<Plugins>
<ext:RowEditing ID="RowEditing1" runat="server" ClicksToMoveEditor="1"
AutoCancel="false" />
</Plugins>
<ColumnModel>
<Columns>
<ext:Column ID="Column3" runat="server" Text="User" DataIndex="name" Width="150" >
<Editor>
<ext:TextField ID="TextField1" ItemID="name" runat="server">
</ext:TextField>
</Editor>
</ext:Column>
<ext:Column ID="Column4" runat="server" Text="Email" Flex="1" DataIndex="email">
<Editor>
<ext:TextField ID="TextField2" runat="server" />
</Editor>
</ext:Column>
</Columns>
</ColumnModel>
<Listeners>
<AfterRender Handler="this.editingPlugin.editor.on('afterrender', function () {
Ext.Array.erase(this.keyNav.map.bindings, 0, 1);
});" Delay="1" />
</Listeners>
</ext:GridPanel>
</form>
</body>
</html>

Daniil
Jun 21, 2013, 3:59 PM
Hi @tanky65,

Please use:

<AfterRender Handler="this.editingPlugin.getEditor().on('afterrender', function () {
Ext.Array.erase(this.keyNav.map.bindings, 0, 1);
});" Delay="1" />

tanky65
Jun 22, 2013, 1:19 PM
I confirm that it works, thanks

equiman
Sep 29, 2014, 3:43 PM
Thanks! work for me too.