.aspx page
<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="test_grid.aspx.vb" Inherits="blueOcean.test_grid" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<ext:ResourceManager runat="server" DisableViewState="true" />
<ext:GridPanel runat="server" ID="gp_code" Title="Test Grid" Frame="true" UI="Primary" Width="500" Height="400" >
<TopBar>
<ext:Toolbar runat="server">
<Items>
<ext:Button runat="server" Text="Load Data" UI="Primary" OnDirectClick="load_data" />
<ext:Button runat="server" Text="Show Selected Data" UI="Primary" OnDirectClick="show_selected_data" />
</Items>
</ext:Toolbar>
</TopBar>
<Store>
<ext:Store ID="str_code" runat="server" PageSize="2000" RemoteFilter="false" RemotePaging="false" RemoteSort="false" AutoLoad="false" >
<Model>
<ext:Model ID="mdl_code" runat="server" IDProperty="code">
<Fields>
<ext:ModelField Name="code" Type="String" />
<ext:ModelField Name="description" Type="String" />
<ext:ModelField Name="count" Type="Int" />
</Fields>
</ext:Model>
</Model>
<Sorters>
<ext:DataSorter Property="code" Direction="ASC" />
</Sorters>
</ext:Store>
</Store>
<ColumnModel>
<Columns>
<ext:Column runat="server" DataIndex="code" Text="Code" />
<ext:NumberColumn runat="server" DataIndex="count" Text="Global Count" Format="0,000" />
<ext:Column runat="server" DataIndex="description" Text="Description" Flex="1" />
</Columns>
</ColumnModel>
<SelectionModel>
<ext:CheckboxSelectionModel runat="server" Mode="Simple" ShowHeaderCheckbox="false" />
</SelectionModel>
<BottomBar>
<ext:PagingToolbar runat="server" />
</BottomBar>
</ext:GridPanel>
</form>
</body>
</html>
code behind page
Imports Ext.Net
Public Class test_grid
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
End Sub
Protected Sub load_data(sender As Object, e As Ext.Net.DirectEventArgs)
Dim lData As New List(Of test_code)
For i As Int32 = 0 To 50
Dim obj As New test_code("code" + i.ToString, i, "desc" + i.ToString)
lData.Add(obj)
Next
str_code.LoadData(lData)
'PreSelect some data
Dim sm As Ext.Net.RowSelectionModel = DirectCast(gp_code.GetSelectionModel, RowSelectionModel)
For i As Int32 = 0 To 50 Step 3
sm.SelectedRows.Add(New SelectedRow("code" + i.ToString))
Next
sm.UpdateSelection()
End Sub
Protected Sub show_selected_data(sender As Object, e As DirectEventArgs)
Dim sm As RowSelectionModel = DirectCast(gp_code.GetSelectionModel, RowSelectionModel)
Dim selected_values As String = ""
For Each row As SelectedRow In sm.SelectedRows
selected_values += row.RecordID + ","
Next
Ext.Net.X.Msg.Alert("Selected Values", selected_values).Show()
End Sub
End Class
Public Class test_code
Protected cpcode As String
Protected cpcount As Int32
Protected cpdescription As String
Public Property code() As String
Get
Return cpcode
End Get
Set(ByVal value As String)
cpcode = value
End Set
End Property
Public Property count() As Int32
Get
Return cpcount
End Get
Set(ByVal value As Int32)
cpcount = value
End Set
End Property
Public Property description() As String
Get
Return cpdescription
End Get
Set(ByVal value As String)
cpdescription = value
End Set
End Property
Public Sub New(code As String, count As Int32, desc As String)
cpcode = code
cpcount = count
cpdescription = desc
End Sub
End Class