PDA

View Full Version : [CLOSED] GridPanel CellSelectionModel error



stratadev
May 02, 2013, 11:00 PM
Hi,

I am trying to Reconfigure my GridPanel(CellSelectionModel) at runtime and it crashes with the following error -


Line: 1248
Error: Unable to get value of the property 'get': object is null or undefined

I am using Ext.Net v2.2.0.13693 and You can reproduce the crash from the below example -


<%@ Page Language="vb" %>
<%@ Register TagPrefix="ext" Namespace="Ext.Net" Assembly="Ext.Net, Version=2.2.0.13693, Culture=neutral, PublicKeyToken=2e12ce3d0176cd87" %>
<%@ Import Namespace="Ext.Net" %>

<script runat="server">
Private Shared LAST_NAMES As String() = New String() {"Jones", "Smith", "Lee", "Wilson", "Black", "Williams", _
"Lewis", "Johnson", "Foot", "Little", "Vee", "Train", _
"Hot", "Mutt"}
Private Shared FIRST_NAMES As String() = New String() {"Fred", "Julie", "Bill", "Ted", "Jack", "John", _
"Mark", "Mike", "Chris", "Bob", "Travis", "Kelly", _
"Sara"}
Private Shared CITIES As String() = New String() {"New York", "Los Angeles", "Chicago", "Houston", "Philadelphia", "Phoenix", _
"San Antonio", "San Diego", "Dallas", "San Jose"}
Private Shared DEPARTMENTS As String() = New String() {"Development", "QA", "Marketing", "Accounting", "Sales"}
Private Shared RANDOM As New Random()

Public Class Office
Public Property City() As String
Get
Return m_City
End Get
Set(value As String)
m_City = value
End Set
End Property
Private m_City As String
Public Property Manager() As String
Get
Return m_Manager
End Get
Set(value As String)
m_Manager = value
End Set
End Property
Private m_Manager As String
Public Property TotalEmployees() As Integer
Get
Return m_TotalEmployees
End Get
Set(value As Integer)
m_TotalEmployees = value
End Set
End Property
Private m_TotalEmployees As Integer
End Class

Public Class Employee
Public Property FirstName() As String
Get
Return m_FirstName
End Get
Set(value As String)
m_FirstName = value
End Set
End Property
Private m_FirstName As String
Public Property LastName() As String
Get
Return m_LastName
End Get
Set(value As String)
m_LastName = value
End Set
End Property
Private m_LastName As String
Public Property No() As Integer
Get
Return m_No
End Get
Set(value As Integer)
m_No = value
End Set
End Property
Private m_No As Integer
Public Property Department() As String
Get
Return m_Department
End Get
Set(value As String)
m_Department = value
End Set
End Property
Private m_Department As String
End Class

Private Function GetUnigueCity(usedCities As List(Of String)) As String
Dim city As String = CITIES(RANDOM.[Next](CITIES.Length))
If usedCities.Contains(city) Then
Return Me.GetUnigueCity(usedCities)
Else
usedCities.Add(city)
Return city
End If
End Function

Private Function GetUnigueName(usedNames As List(Of String)) As String()
Dim firstName As String = FIRST_NAMES(RANDOM.[Next](FIRST_NAMES.Length))
Dim lastName As String = LAST_NAMES(RANDOM.[Next](LAST_NAMES.Length))
Dim name As String() = New String() {firstName, lastName}
Dim key As String = firstName & lastName

If usedNames.Contains(key) Then
Return Me.GetUnigueName(usedNames)
Else
usedNames.Add(key)
Return name
End If
End Function

Private Function GetOfficesData() As Object()
Dim data As Office() = New Office(6) {}
Dim usedNames As New List(Of String)()
Dim usedCities As New List(Of String)()

For i As Integer = 0 To 6
Dim name As String() = Me.GetUnigueName(usedNames)
data(i) = New Office() With { _
.City = Me.GetUnigueCity(usedCities), _
.Manager = name(0) & " " & name(1), _
.TotalEmployees = RANDOM.[Next](10, 25) _
}
Next

Return data
End Function

Private Function GetEmployeesData() As Object()
Dim data As Employee() = New Employee(19) {}
Dim usedNames As New List(Of String)()

For i As Integer = 0 To 19
Dim name As String() = Me.GetUnigueName(usedNames)
data(i) = New Employee() With { _
.FirstName = name(0), _
.LastName = name(1), _
.No = Integer.Parse(RANDOM.[Next](100, 200).ToString() + RANDOM.[Next](100, 200).ToString()), _
.Department = DEPARTMENTS(RANDOM.[Next](DEPARTMENTS.Length)) _
}
Next

Return data
End Function

Private Function GetOfficeStore() As AbstractStore
Dim store As New Store()
store.Data = Me.GetOfficesData()
store.Fields.Add("City", "TotalEmployees", "Manager")

Return store
End Function

Private Function GetEmployeesStore() As AbstractStore
Dim store As New Store()
store.Data = Me.GetEmployeesData()
store.Fields.Add("FirstName", "LastName", "No", "Department")

Return store
End Function

Private Function GetOfficesColumns() As ColumnBase()
Return New ColumnBase() {New Column() With { _
.Text = "City", _
.DataIndex = "City", _
.Flex = 1 _
}, New Column() With { _
.Text = "Total Employees", _
.DataIndex = "TotalEmployees", _
.Width = 140 _
}, New Column() With { _
.Text = "Manager", _
.DataIndex = "Manager", _
.Width = 120 _
}}
End Function

Private Function GetEmployeesColumns() As ColumnBase()
Return New ColumnBase() {New Column() With { _
.Text = "First Name", _
.DataIndex = "FirstName", _
.Flex = 1 _
}, New Column() With { _
.Text = "Last Name", _
.DataIndex = "LastName", _
.Flex = 1 _
}, New Column() With { _
.Text = "Employee No.", _
.DataIndex = "No", _
.Width = 120 _
}, New Column() With { _
.Text = "Department", _
.DataIndex = "Department", _
.Flex = 1 _
}}
End Function

Protected Sub ShowOfficesButton_Click(sender As Object, e As DirectEventArgs)

Me.GridPanel1.Title = "Offices"
Me.GridPanel1.Reconfigure(Me.GetOfficeStore(), Me.GetOfficesColumns())
Me.ShowOfficesButton.Disabled = True
Me.ShowEmployeesButton.Disabled = False

End Sub

Protected Sub ShowEmployeesButton_Click(sender As Object, e As DirectEventArgs)

Me.GridPanel1.Title = "Employees"
Me.GridPanel1.Reconfigure(Me.GetEmployeesStore(), Me.GetEmployeesColumns())
Me.ShowEmployeesButton.Disabled = True
Me.ShowOfficesButton.Disabled = False

End Sub

</script>
<!DOCTYPE html>
<html>
<head id="Head1" runat="server">
<title>Reconfigure GridPanel - Ext.NET Examples</title>
<link href="/resources/css/examples.css" rel="stylesheet" />
</head>
<body>
<form id="Form1" runat="server">
<ext:ResourceManager ID="ResourceManager1" runat="server" />
<ext:Viewport ID="Viewport1" runat="server" Margins="0 0 10 0">
<LayoutConfig>
<ext:VBoxLayoutConfig Align="Center" Pack="Center" />
</LayoutConfig>
<Items>
<ext:Container ID="Container1" runat="server" Width="500" Height="330">
<LayoutConfig>
<ext:VBoxLayoutConfig Align="Stretch" />
</LayoutConfig>
<Items>
<ext:Container ID="Container2" runat="server" Layout="HBoxLayout">
<Items>
<ext:Button ID="ShowOfficesButton" runat="server" Text="Show Offices" OnDirectClick="ShowOfficesButton_Click" />
<ext:Button ID="ShowEmployeesButton" runat="server" Text="Show Employees" OnDirectClick="ShowEmployeesButton_Click"
Margins="0 0 0 10" />
</Items>
</ext:Container>
<ext:GridPanel ID="GridPanel1" runat="server" Flex="1" Title="Selected Department goes here ... ">
<SelectionModel>
<ext:CellSelectionModel runat="server" Mode="Single">
</ext:CellSelectionModel>
</SelectionModel>
</ext:GridPanel>
</Items>
</ext:Container>
</Items>
</ext:Viewport>
</form>
</body>
</html>

Daniil
May 03, 2013, 6:32 AM
Hi @stratadev,

I am unable to reproduce with v2.2 release and the latest sources from the SVN trunk.

Any specific details how to reproduce?

stratadev
May 03, 2013, 3:47 PM
Hi @stratadev,

I am unable to reproduce with v2.2 release and the latest sources from еру SVN trunk.

Any specific details how to reproduce?

Hello Daniil,

After the page loads, If I try clicking on any of the grid cells, it crashes.

Daniil
May 03, 2013, 4:23 PM
Clicking on cells doesn't throw an error for me. Tested in FireFox.

Does the issue depend on a browser?

stratadev
May 03, 2013, 4:31 PM
Clicking on cells doesn't throw an error for me. Tested in FireFox.

Does the issue depend on a browser?

Can you try on IE 9.

I noticed that firefox and chrome are supressing the error unlike IE.
If you look at the error console, it should say something like "r is undefined"

Baidaly
May 03, 2013, 10:12 PM
Hello!

Sorry, but I couldn't reproduce your problem. Can you check that you don't use IE9 in compatibility mode.

Daniil
May 06, 2013, 5:40 AM
I tried in IE9 as well and still can't reproduce.


I am using Ext.Net v2.2.0.13693

Could you clarify where you got it? The official release or some SVN revision?

stratadev
May 06, 2013, 4:52 PM
Sorry guys, the Ext.Net dll I was working with was most likely from an SVN Revision.

I just updated the dlls to a standard release and the problem went away.

Thanks for looking into this issue.

Please go ahead and close this thread.