Nov 05, 2010, 2:09 PM
CheckColumn double click problem
Hi,
I'm using a CheckColumn in a GridPanel component. When I run double click event in any cell of CheckColumn, occurs this javascript exception: "Runtime Error in Microsoft JScript: Object does not support this property or method".
The error occurs in this function: "getCellEditor:function(a,b){return this.config[a].getCellEditor(b)}".
My .aspx code:
Thanks in Advance!
I'm using a CheckColumn in a GridPanel component. When I run double click event in any cell of CheckColumn, occurs this javascript exception: "Runtime Error in Microsoft JScript: Object does not support this property or method".
The error occurs in this function: "getCellEditor:function(a,b){return this.config[a].getCellEditor(b)}".
My .aspx code:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="EditarNaGrade.aspx.cs"
Inherits="RCNBS.WebTopManager.Paginas.CONCEITO.EditarNaGrade" %>
<!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>Grid with AutoSave - Ext.NET Examples</title>
<link href="../../../../resources/css/examples.css" rel="stylesheet" type="text/css" />
</head>
<body>
<form id="Form1" runat="server">
<ext:ResourceManager ID="ResourceManager1" runat="server" />
<ext:Store ID="Store1" runat="server" AutoSave="true" ShowWarningOnFailure="false"
OnBeforeStoreChanged="HandleChanges" SkipIdForNewRecords="false" RefreshAfterSaving="None">
<Reader>
<ext:JsonReader IDProperty="Id">
<Fields>
<ext:RecordField Name="Id" />
<ext:RecordField Name="Email" AllowBlank="false" />
<ext:RecordField Name="First" AllowBlank="false" />
<ext:RecordField Name="Last" AllowBlank="false" />
<ext:RecordField Name="estahAtivo" AllowBlank="false" />
<ext:RecordField Name="ehAdministrador" AllowBlank="false" />
</Fields>
</ext:JsonReader>
</Reader>
</ext:Store>
<ext:Hidden ID="UseConfirmation" runat="server" Text="false" />
<ext:GridPanel ID="GridPanel1" runat="server" Icon="Table" Frame="true" Title="Users"
Height="400" Width="500" StoreID="Store1" StyleSpec="margin-top: 10px">
<ColumnModel>
<Columns>
<ext:Column Header="ID" Width="40" DataIndex="Id">
<Editor>
</Editor>
</ext:Column>
<ext:Column Header="Email" Width="100" DataIndex="Email" />
<ext:CheckColumn Header="Ativo" Width="100" DataIndex="estahAtivo" Editable="false" />
<ext:CheckColumn Header="Administrador" Width="100" DataIndex="ehAdministrador" Editable="true">
<Editor>
<ext:Checkbox ID="teste" runat="server">
</ext:Checkbox>
</Editor>
</ext:CheckColumn>
<ext:Column Header="First" Width="50" DataIndex="First" />
<ext:Column Header="Last" Width="50" DataIndex="Last" />
</Columns>
</ColumnModel>
<View>
<ext:GridView ID="GridView1" runat="server" ForceFit="true" />
</View>
<TopBar>
<ext:Toolbar ID="Toolbar1" runat="server">
<Items>
<ext:Button ID="Button4" runat="server" Text="Add" Icon="Add">
<Listeners>
<Click Handler="#{GridPanel1}.insertRecord();" />
</Listeners>
</ext:Button>
<ext:ToolbarSeparator />
<ext:Button ID="Button6" runat="server" Text="Auto Save" EnableToggle="true" Pressed="true"
ToolTip="When enabled, Store will execute Ajax requests as soon as a Record becomes dirty.">
<Listeners>
<Toggle Handler="#{Store1}.autoSave = pressed;#{Store1}.useIdConfirmation = !pressed;#{UseConfirmation}.setValue(!pressed);" />
</Listeners>
</ext:Button>
</Items>
</ext:Toolbar>
</TopBar>
<Buttons>
<ext:Button ID="Button7" runat="server" Text="Save" Icon="Disk">
<Listeners>
<Click Handler="#{GridPanel1}.save();" />
</Listeners>
</ext:Button>
</Buttons>
</ext:GridPanel>
</form>
</body>
</html>
.cs Codeusing System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Ext.Net;
namespace RCNBS.WebTopManager.Paginas.CONCEITO
{
public partial class EditarNaGrade : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
bool useConfirmation;
if (bool.TryParse(UseConfirmation.Text, out useConfirmation))
{
this.Store1.SuspendScripting();
this.Store1.UseIdConfirmation = useConfirmation;
this.Store1.ResumeScripting();
}
this.BindData();
}
/// <summary>
///
/// </summary>
public class TestPerson
{
public int Id
{
get;
set;
}
public string Email
{
get;
set;
}
public string First
{
get;
set;
}
public string Last
{
get;
set;
}
public bool estahAtivo
{
get;
set;
}
public bool ehAdministrador
{
get;
set;
}
}
//----------------Page------------------------
private List<TestPerson> TestPersons
{
get
{
return new List<TestPerson>
{
new TestPerson{Id=1, Email="h2o@mail.com", First="Thiago", Last="Nogueira", estahAtivo = true, ehAdministrador= false},
new TestPerson{Id=2, Email="tani@mail.com", First="Tanielian", Last="Barreira", estahAtivo = true, ehAdministrador= false},
new TestPerson{Id=3, Email="sald@mail.com", First="Raphael", Last="Saldanha", estahAtivo = false, ehAdministrador= true},
new TestPerson{Id=4, Email="milena@mail.com", First="Milena", Last="Nogueira", estahAtivo = true, ehAdministrador= false},
new TestPerson{Id=5, Email="larissa@mail.com", First="Larissa", Last="Castro", estahAtivo = false, ehAdministrador= true},
new TestPerson{Id=6, Email="bim@mail.com", First="Thiago", Last="Pinheiro", estahAtivo = true, ehAdministrador= false}
};
}
}
private static int curId = 7;
private static object lockObj = new object();
private int NewId
{
get
{
return System.Threading.Interlocked.Increment(ref curId);
}
}
private List<TestPerson> CurrentData
{
get
{
var persons = this.Session["TestPersons"];
if (persons == null)
{
persons = this.TestPersons;
this.Session["TestPersons"] = persons;
}
return (List<TestPerson>)persons;
}
}
private int AddPerson(TestPerson person)
{
lock (lockObj)
{
var persons = this.CurrentData;
person.Id = this.NewId;
persons.Add(person);
this.Session["TestPersons"] = persons;
return person.Id;
}
}
private void DeletePerson(int id)
{
lock (lockObj)
{
var persons = this.CurrentData;
TestPerson person = null;
foreach (TestPerson p in persons)
{
if (p.Id == id)
{
person = p;
break;
}
}
if (person == null)
{
throw new Exception("TestPerson not found");
}
persons.Remove(person);
this.Session["TestPersons"] = persons;
}
}
private void UpdatePerson(TestPerson person)
{
lock (lockObj)
{
var persons = this.CurrentData;
TestPerson updatingPerson = null;
foreach (TestPerson p in persons)
{
if (p.Id == person.Id)
{
updatingPerson = p;
break;
}
}
if (updatingPerson == null)
{
throw new Exception("TestPerson not found");
}
updatingPerson.Email = person.Email;
updatingPerson.Last = person.Last;
updatingPerson.First = person.First;
this.Session["TestPersons"] = persons;
}
}
private void BindData()
{
if (X.IsAjaxRequest)
{
return;
}
this.Store1.DataSource = this.CurrentData;
this.Store1.DataBind();
}
protected void HandleChanges(object sender, BeforeStoreChangedEventArgs e)
{
ChangeRecords<TestPerson> persons = e.DataHandler.ObjectData<TestPerson>();
foreach (TestPerson created in persons.Created)
{
int tempId = created.Id;
int newId = this.AddPerson(created);
if (Store1.UseIdConfirmation)
{
e.ConfirmationList.ConfirmRecord(tempId.ToString(), newId.ToString());
}
else
{
Store1.UpdateRecordId(tempId, newId);
}
}
foreach (TestPerson deleted in persons.Deleted)
{
this.DeletePerson(deleted.Id);
if (Store1.UseIdConfirmation)
{
e.ConfirmationList.ConfirmRecord(deleted.Id.ToString());
}
}
foreach (TestPerson updated in persons.Updated)
{
this.UpdatePerson(updated);
if (Store1.UseIdConfirmation)
{
e.ConfirmationList.ConfirmRecord(updated.Id.ToString());
}
}
e.Cancel = true;
}
}
}
Can you help me?!Thanks in Advance!