PDA

View Full Version : [CLOSED] Ext.net 2 Beta Release: Error when rebuilding grid



supera
Apr 13, 2012, 5:39 PM
Hi!

After I update source codes of ext.net from subversion and recompile, I'm getting this error when I rebuild my gridPanel.

Runtime Error in Microsoft JScript: Object does not support property or method 'onChange'

4102

I made a little example... please, click in 'Refresh' button to trigger error.

Main Page


<%@ Page Language="vb" %>
<%@ 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">

<script runat="server">

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

If (Not ExtNet.IsAjaxRequest) Then

GridPanel1_BuildSet()

End If

End Sub

Protected Sub GridPanel1_BuildSet()
Dim col As Ext.Net.Column.Config

If (ExtNet.IsAjaxRequest) Then
Me.Store1.RemoveFields()
End If

'refaz os campos do modelo
Me.GridPanel1_AddField(New ModelField("ID", ModelFieldType.Int))
Me.GridPanel1_AddField(New ModelField("Nome", ModelFieldType.String))
Me.Store1.RebuildMeta()

Me.GridPanel1_BindSet()

col = New Ext.Net.Column.Config
col.Width = 70
col.Text = "ID"
col.DataIndex = "ID"
col.Align = Alignment.Right
Me.gridPanel1.ColumnModel.Columns.Add(New Column(col))

col = New Ext.Net.Column.Config
col.Width = 250
col.Text = "Name"
col.DataIndex = "Nome"
col.Align = Alignment.Left
Me.gridPanel1.ColumnModel.Columns.Add(New Column(col))

If (ExtNet.IsAjaxRequest) Then
Me.gridPanel1.Reconfigure()
End If

End Sub

Private Sub GridPanel1_BindSet()

'refresco o grid para disparar o webservice Json
gridPanel1.Call("store.reload")

End Sub

Private Sub GridPanel1_AddField(field As ModelField)
If (ExtNet.IsAjaxRequest) Then
Me.Store1.AddField(field)
Else
Me.Store1.Model(0).Fields.Add(field)
End If
End Sub

Protected Sub RefreshGrid(sender As Object, evt As DirectEventArgs)
GridPanel1_BuildSet()
End Sub

</script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<ext:ResourceManager ID="ResourceManager1" runat="server" />
<form id="form1" runat="server">
<ext:GridPanel runat="server" ID="gridPanel1" EnableColumnHide="false" EnableColumnMove="false" Flex="1" >
<Store>
<ext:Store runat="server" ID="Store1" IgnoreExtraFields="false" PageSize="10" RemoteSort="true" AutoLoad="false">
<Proxy>
<ext:AjaxProxy Json="true" Url="/JSonDataPaging.asmx/getData">
<ActionMethods Read="POST" />
<Reader>
<ext:JsonReader Root="d.Data" TotalProperty="d.TotalRecords" />
</Reader>
</ext:AjaxProxy>
</Proxy>
<AutoLoadParams>
<ext:Parameter Name="start" Value="0" Mode="Raw" />
<ext:Parameter Name="limit" Value="10" Mode="Raw" />
</AutoLoadParams>
<Parameters>
<ext:StoreParameter Name="filter" Value="" Mode="Value" />
</Parameters>
<Model>
<ext:Model ID="modelExplorerWebContext" runat="server">
</ext:Model>
</Model>
</ext:Store>
</Store>
<SelectionModel>
<ext:RowSelectionModel runat="server" ID="rsmExplorerWebContext" Mode="Single"/>
</SelectionModel>
<BottomBar>
<ext:PagingToolbar ID="tbPaging1" runat="server" />
</BottomBar>
<Buttons>
<ext:Button runat="server" ID="btnRefresh" Text="Refresh">
<DirectEvents>
<Click OnEvent="RefreshGrid" />
</DirectEvents>
</ext:Button>
</Buttons>
</ext:GridPanel>
</form>
</body>
</html>


WebService JSonDataPaging.asmx and class Person


Imports System.Web.Services
Imports System.Web.Services.Protocols
Imports System.ComponentModel
Imports System.Web.Script.Services

' To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
' <System.Web.Script.Services.ScriptService()> _
<System.Web.Services.WebService(Namespace:="http://tempuri.org/")> _
<System.Web.Services.WebServiceBinding(ConformsTo:= WsiProfiles.BasicProfile1_1)> _
<ToolboxItem(False)> _
<System.Web.Script.Services.ScriptService()>
Public Class JSonDataPaging
Inherits System.Web.Services.WebService

<WebMethod(enableSession:=True)> _
<ScriptMethod()>
Public Function getData(start As Long, limit As Long, filter As String) As Ext.Net.Paging(Of Person)

Dim vRet As New List(Of Person)

vRet.Add(New Person(1, "Person 01"))
vRet.Add(New Person(2, "Person 02"))
vRet.Add(New Person(3, "Person 03"))
vRet.Add(New Person(4, "Person 04"))
vRet.Add(New Person(5, "Person 05"))
vRet.Add(New Person(6, "Person 06"))
vRet.Add(New Person(7, "Person 07"))
vRet.Add(New Person(8, "Person 08"))
vRet.Add(New Person(9, "Person 09"))

Return New Ext.Net.Paging(Of Person)(vRet, vRet.Count)

End Function

End Class

Public Class Person
Private mvarID As Long
Private mvarNome As String

Sub New(pID As Long, pNome As String)
mvarID = pID
mvarNome = pNome
End Sub

Property ID As String
Get
Return mvarID
End Get
Set(value As String)
mvarID = value
End Set
End Property

Property Nome As String
Get
Return mvarNome
End Get
Set(value As String)
mvarNome = value
End Set
End Property
End Class

Vladimir
Apr 13, 2012, 6:06 PM
Hi,

Please update from SVN and retest

supera
Apr 13, 2012, 7:47 PM
Hi Vladimir...

Works fine.

Thanks a lot.