Jun 11, 2013, 9:36 AM
[CLOSED] Fill combobox in gridpanel from behind
Hi,
I have made a poup window with some gridpanels. One of the gridpanels contains a combobox. The contents of the combobox should be filled on the basis of some selections by the user. This means that the contents of the combobox is only known at the moment that the panel is shown.
I made a simplified example that shows the problem. The example is based on one of the ext.net examples (Form/Combobox/Items actions).
I get an error message: You have to set widget's ID to call its methods (IScriptable.cs). ID's are all set, so what could be the problem?
Thanks, Hans Wapenaar
I have made a poup window with some gridpanels. One of the gridpanels contains a combobox. The contents of the combobox should be filled on the basis of some selections by the user. This means that the contents of the combobox is only known at the moment that the panel is shown.
I made a simplified example that shows the problem. The example is based on one of the ext.net examples (Form/Combobox/Items actions).
I get an error message: You have to set widget's ID to call its methods (IScriptable.cs). ID's are all set, so what could be the problem?
Thanks, Hans Wapenaar
Imports Ext.Net
Imports Ext.Net.Utilities
Imports ExtX = Ext.Net.X
Partial Class Default7
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
If (Not ExtX.IsAjaxRequest) Then
Me.StoreStructure.DataSource = New Object() {
New Object() {"id 1", "Text 1", "none"},
New Object() {"id 2", "Text 2", "none"},
New Object() {"id 3", "Text 3", "none"},
New Object() {"id 4", "Text 4", "none"},
New Object() {"id 5", "Text 5", "none"},
New Object() {"id 6", "Text 6", "none"},
New Object() {"id 7", "Text 7", "none"},
New Object() {"id 8", "Text 8", "none"},
New Object() {"id 9", "Text 9", "none"}
}
Me.StoreStructure.DataBind()
End If
End Sub
Protected Sub btn1_OnChange(ByVal sender As Object, ByVal e As DirectEventArgs)
ImportDetailsWindow.Show()
End Sub
Protected Sub InsertRecord(ByVal sender As Object, ByVal e As DirectEventArgs)
Dim values As Dictionary(Of String, Object) = New Dictionary(Of String, Object)
values.Add("Text", "Text0")
values.Add("Value", "0")
Me.ComboBox1.InsertRecord(1, values)
End Sub
Protected Sub InsertRecord2(ByVal sender As Object, ByVal e As DirectEventArgs)
Me.ComboBox2.InsertItem(0, "Text0", "0")
End Sub
End Class
<%@ Page Language="VB" AutoEventWireup="true" CodeFile="Default7.aspx.vb" Inherits="Default7" %>
<!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 runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<ext:ResourceManager ID="ResourceManager1" runat="server" />
<ext:Panel ID="pnlImport" runat="server"
Header="false"
FrameHeader="false"
Border="false"
MarginSpec="0 0 0 0"
PaddingSpec="0 0 0 0">
<Items>
<ext:Button ID="btn1" runat="server" Text="test" >
<DirectEvents>
<Click OnEvent="btn1_OnChange" ></Click>
</DirectEvents>
</ext:Button>
</Items>
</ext:Panel>
<ext:Window
ID="ImportDetailsWindow"
runat="server"
Icon="Group"
Title="Import"
Width="600"
Height="600"
AutoShow="false"
Modal="true"
Hidden="true"
Layout="BorderLayout" >
<Items>
<ext:Panel ID="panelStructure" runat="server"
Region="Center"
Header="true" Title="Kolommen"
FrameHeader="false"
Border="false"
MarginSpec="0 0 0 0"
PaddingSpec="0 0 0 0" >
<Items>
<ext:Button ID="Button1" runat="server" Text="Insert: server side (1)">
<DirectEvents>
<Click OnEvent="InsertRecord" />
</DirectEvents>
</ext:Button>
<ext:Button ID="Button2" runat="server" Text="Insert: server side (2)">
<DirectEvents>
<Click OnEvent="InsertRecord2" />
</DirectEvents>
</ext:Button>
<ext:GridPanel
ID="GridPanelStructure"
runat="server"
Border="false"
HideHeaders="false"
MarginSpec="0 0 0 0"
PaddingSpec="0 0 0 0"
StyleSpec="background-color: transparent;"
Hidden="false"
AutoScroll="false"
ForceFit="true" >
<Store>
<ext:Store ID="StoreStructure" runat="server" >
<Model>
<ext:Model ID="ModelStructure" runat="server" IDProperty="ColumnName" >
<Fields>
<ext:ModelField Name="columnname" Type="String" />
<ext:ModelField Name="columntype" Type="String" />
<ext:ModelField Name="match" Type="String" />
</Fields>
</ext:Model>
</Model>
</ext:Store>
</Store>
<ColumnModel ForceFit="true" >
<Columns>
<ext:Column ID="ColumnColumnName" ColumnID="ColumnColumnName" runat="server" DataIndex="columnname" Text="columnname" Visible="true" />
<ext:Column ID="ColumnColumnType" ColumnID="ColumnColumnType" runat="server" DataIndex="columntype" Text="columntype" Visible="true" />
<ext:ComponentColumn ID="ComponentColumn1"
runat="server"
Editor="true"
DataIndex="match"
Flex="1"
Text="ComboBox1">
<Component>
<ext:ComboBox ID="ComboBox1" runat="server"
DisplayField="Text"
ValueField="Value" Mode="Local">
<Store>
<ext:Store ID="Store1" runat="server">
<Model>
<ext:Model ID="Model1" runat="server" IDProperty="Value">
<Fields>
<ext:ModelField Name="Text" />
<ext:ModelField Name="Value" />
</Fields>
</ext:Model>
</Model>
</ext:Store>
</Store>
<Items>
</Items>
</ext:ComboBox>
</Component>
</ext:ComponentColumn>
<ext:ComponentColumn ID="ComponentColumn2"
runat="server"
Editor="true"
DataIndex="match"
Flex="1"
Text="ComboBox2">
<Component>
<ext:ComboBox ID="ComboBox2" runat="server">
<Items>
<ext:ListItem Text="Text2" Value="2" />
<ext:ListItem Text="Text3" Value="3" />
<ext:ListItem Text="Text4" Value="4" />
<ext:ListItem Text="Text5" Value="5" />
</Items>
</ext:ComboBox>
</Component>
</ext:ComponentColumn>
</Columns>
</ColumnModel>
</ext:GridPanel>
</Items>
</ext:Panel>
</Items>
</ext:Window>
</form>
</body>
</html>
Last edited by Daniil; Jun 12, 2013 at 6:37 PM.
Reason: [CLOSED]