Feb 08, 2012, 2:27 PM
[CLOSED] JavaScript error when I try to refresh the data from my GridPanel.
Hi!
I'm getting a JavaScript error when I try to refresh the data from my GridPanel.
1 - My GridPanel is reconfigured in page_load and gridPanel.OnReadData event, following the example https://examples2.ext.net/#/GridPane...l/Reconfigure/
2 - The error is: Runtime Error in Microsoft JScript: 'I' is not defined.
Attachment 3815
3 - I made a little test example. The error occurs both when click in button 'GridPanel Reload' of TOP toolbar and when I click on the button 'refresh' of toolbarPaging
I'm getting a JavaScript error when I try to refresh the data from my GridPanel.
1 - My GridPanel is reconfigured in page_load and gridPanel.OnReadData event, following the example https://examples2.ext.net/#/GridPane...l/Reconfigure/
2 - The error is: Runtime Error in Microsoft JScript: 'I' is not defined.
Attachment 3815
3 - I made a little test example. The error occurs both when click in button 'GridPanel Reload' of TOP toolbar and when I click on the button 'refresh' of toolbarPaging
<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="Test1.aspx.vb" Inherits="WebApplication3.Test1" %>
<%@ 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">
''ESTES COMANDOS SÃO PERTENCENTES AO GRID E AO STORE, E ESTÃO AQUI PARA ATUALIZAR O MESMO COM A NOVA ESTRUTURA
Protected Sub Page_Load(sender As Object, E As EventArgs) Handles Me.Load
If (Not ExtNet.IsAjaxRequest) Then
BuildSet()
End If
End Sub
Private Function getDataTable() As System.Data.DataTable
Dim table As System.Data.DataTable = New System.Data.DataTable
table.Columns.Add(New System.Data.DataColumn("ID"))
table.Columns.Add(New System.Data.DataColumn("Name"))
table.Rows.Add(1, "Anderson Silva")
table.Rows.Add(1, "José Aldo")
table.Rows.Add(1, "Vitor Belfort")
table.Rows.Add(1, "Lyoto Machida")
table.Rows.Add(1, "Maurício Shogun Rua")
Return table
End Function
Protected Sub BuildSet()
Dim colConf As Ext.Net.Column.Config
If (ExtNet.IsAjaxRequest) Then
Me.Store1.RemoveFields()
End If
'refaz os campos do modelo
Me.AddField(New ModelField("ID", Ext.Net.ModelFieldType.Int))
Me.AddField(New ModelField("Name", Ext.Net.ModelFieldType.String))
Me.Store1.RebuildMeta()
Me.BindSet()
colConf = New Ext.Net.Column.Config
colConf.DataIndex = "ID"
colConf.Text = "ID"
Me.gridPanel1.ColumnModel.Columns.Add(New Column(colConf))
colConf = New Ext.Net.Column.Config
colConf.DataIndex = "Name"
colConf.Text = "Name"
Me.gridPanel1.ColumnModel.Columns.Add(New Column(colConf))
If (ExtNet.IsAjaxRequest) Then
Me.gridPanel1.Reconfigure()
End If
End Sub
Private Sub BindSet()
Me.Store1.DataSource = Me.getDataTable()
Me.Store1.DataBind()
End Sub
Private Sub 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 store_Refresh(sender As Object, e As StoreRefreshDataEventArgs)
Me.BuildSet()
End Sub
Private Sub btnRefresh_Click(sender As Object, e As DirectEventArgs)
gridPanel1.Call("store.reload")
End Sub
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<ext:ResourceManager ID="resManagerSGCO" runat="server" Namespace="SuperaWeb.SGCO" />
<form runat="server">
<ext:Panel runat="server" ID="panel1" Title="Test of OnDirectClick!" Layout="FitLayout" Flex="1">
<TopBar>
<ext:Toolbar runat="server" ID="ctl61">
<Items>
<ext:Button runat="server" id="btnRefresh" Icon="Reload" Text="GridPanel Reload" OnDirectClick="btnRefresh_Click" />
</Items>
</ext:Toolbar>
</TopBar>
<Items>
<ext:GridPanel runat="server" ID="gridPanel1" Flex="1" >
<Store>
<ext:Store runat="server" ID="Store1" OnReadData="store_Refresh" IgnoreExtraFields="false" PageSize="10" RemoteSort="true" >
<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>
</ext:GridPanel>
</Items>
</ext:Panel>
</form>
</body>
</html>
Last edited by Daniil; Feb 08, 2012 at 3:14 PM.
Reason: [CLOSED]