Oct 24, 2011, 12:44 PM
[CLOSED] EditableGrid Plugin bug
I have the following scenario in my application:
1 - There is a screen with a grid on it. In this grid there is an editable dropdownlist.
2 - The user can change the value of some of it's items and then click a button.
3 - When the button is clicked, the items which the values were changed are removed from the grid (i make another databind for it).
The problem is that if the focus is on the last dropdown of the last row of the grid and it's removed, i get a javascript error. I guess it is trying to place the focus on this row, and since it doesn't exist anymore i get the error.
To reproduce, run the source below, click on the button "Databind". The grid will be loaded with values. Then, change the value of the dropdown of the last row and without removing the focus, click "Processar". A javascript error will occur. If you do the same eith the focus in another row, there is no error.
1 - There is a screen with a grid on it. In this grid there is an editable dropdownlist.
2 - The user can change the value of some of it's items and then click a button.
3 - When the button is clicked, the items which the values were changed are removed from the grid (i make another databind for it).
The problem is that if the focus is on the last dropdown of the last row of the grid and it's removed, i get a javascript error. I guess it is trying to place the focus on this row, and since it doesn't exist anymore i get the error.
To reproduce, run the source below, click on the button "Databind". The grid will be loaded with values. Then, change the value of the dropdown of the last row and without removing the focus, click "Processar". A javascript error will occur. If you do the same eith the focus in another row, there is no error.
<%@ Page Language="C#" AutoEventWireup="true" %>
<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title>Untitled Page</title>
<script runat="server">
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
btTesteDataBind.DirectClick += new ComponentDirectEvent.DirectEventHandler(btTesteDataBind_DirectClick);
btTesteProcessar.DirectClick += new ComponentDirectEvent.DirectEventHandler(btTesteProcessar_DirectClick);
btTesteProcessar.DirectEvents.Click.EventMask.ShowMask = true;
}
void btTesteProcessar_DirectClick(object sender, DirectEventArgs e)
{
storeAprovacoes.DataSource = new object[]
{
new { Descricao = "Item 1"},
new { Descricao = "Item 2"},
new { Descricao = "Item 3"},
new { Descricao = "Item 4"}
};
storeAprovacoes.DataBind();
}
void btTesteDataBind_DirectClick(object sender, DirectEventArgs e)
{
storeAprovacoes.DataSource = new object[]
{
new { Descricao = "Item 1"},
new { Descricao = "Item 2"},
new { Descricao = "Item 3"},
new { Descricao = "Item 4"},
new { Descricao = "Item 5"}
};
storeAprovacoes.DataBind();
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<ext:ResourceManager runat="server" ID="rm1">
</ext:ResourceManager>
<ext:Viewport runat="server" Layout="FitLayout">
<Items>
<ext:GridPanel ID="grdAprovacoes" runat="server" SkinID="PadraoFit" EnableViewState="false">
<TopBar>
<ext:Toolbar runat="server" ID="tb1">
<Items>
<ext:Button ID="btTesteDataBind" Text="Databind" runat="server">
</ext:Button>
<ext:Button ID="btTesteProcessar" Text="Processar" runat="server">
</ext:Button>
</Items>
</ext:Toolbar>
</TopBar>
<Store>
<ext:Store ID="storeAprovacoes" runat="server" EnableViewState="false">
<Reader>
<ext:JsonReader>
<Fields>
<ext:RecordField Name="StatusAprov" Type="String" />
<ext:RecordField Name="Descricao" Type="String" />
</Fields>
</ext:JsonReader>
</Reader>
</ext:Store>
</Store>
<ColumnModel ID="ColumnModel1" runat="server" EnableViewState="false">
<Columns>
<ext:Column Width="85" DataIndex="StatusAprov" Header="Apr/Rep/Canc" Fixed="true"
Locked="true" Hideable="false" Groupable="true">
<Editor>
<ext:ComboBox ID="cmbStatusAprov" runat="server" Editable="false" ForceSelection="false"
EnableViewState="false">
<Items>
<ext:ListItem Text=" " Value="" />
<ext:ListItem Text="Aprovado" Value="Aprovado" />
<ext:ListItem Text="Reprovado" Value="Reprovado" />
<ext:ListItem Text="Cancelado" Value="Cancelado" />
</Items>
<Listeners>
<%--<Select Handler="StatusAprov_Change(#{cmbStatusAprov});" />--%>
<%--<Change Handler="StatusAprov_Change(#{cmbStatusAprov});" />--%>
</Listeners>
</ext:ComboBox>
</Editor>
</ext:Column>
<ext:Column DataIndex="Descricao" Header="Descricao">
</ext:Column>
</Columns>
</ColumnModel>
<Plugins>
<ext:EditableGrid ID="EditableGrid1" runat="server" />
</Plugins>
</ext:GridPanel>
</Items>
</ext:Viewport>
</div>
</form>
</body>
</html>
Last edited by Daniil; Oct 27, 2011 at 6:53 PM.
Reason: [CLOSED]