PDA

View Full Version : [CLOSED] Controls not showing data in store in AfterRender event of window



RCM
Aug 29, 2012, 10:47 PM
Hi,

I am trying a load the store for some controls on a window in the afterrender event. The store has the data but the data is not being displayed in the controls. See example below with combo box. happens with the other data controls that uses a store. please advise, this worked in version 1.0.

I tried using the Show event but the event does not seem to work.



<%@ Page Language="C#" %>

<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<script type="text/javascript">
var getData = function (operation) {
var data = Array();
var item = { Key: 1, Value: "Name" }
data.push(item);
item = { Key: 1, Value: "Surname" }
data.push(item);

var Combo1 = Ext.getCmp("Combo1")
var Combo2 = Ext.getCmp("Combo2")
App.combo1.store.loadData(data);
App.combo2.store.loadData(data);
};

</script>
<!DOCTYPE html>
<html>
<head runat="server">
<title>Ext.NET v2 Example</title>
<style type="text/css">
.my-cells .x-grid-cell-inner {
white-space: normal;
}
</style>
</head>
<body>
<ext:ResourceManager runat="server" />
<ext:Window ID="windowExportWorkItems" runat="server" AutoHeight="true" Width="300"
Title="Load combo" Draggable="true" Resizable="false" Modal="true" IDMode="Static"
Closable="true">
<Defaults>
<ext:Parameter Name="IDMode" Value="Static" />
</Defaults>
<Items>
<ext:ComboBox ID="combo1" runat="server" TabIndex="61" FieldLabel="Combo1" Width="250"
DisplayField="Value" AnchorHorizontal="100%" QueryMode="Local" AutoDataBind="true"
EnableKeyEvents="true" Editable="true" ForceSelection="true">
<Store>
<ext:Store runat="server">
<Model>
<ext:Model runat="server">
<Fields>
<ext:ModelField Name="Key" />
<ext:ModelField Name="Value" />
</Fields>
</ext:Model>
</Model>
</ext:Store>
</Store>
<Listeners>

</Listeners>
</ext:ComboBox>
<ext:ComboBox ID="combo2" runat="server" TabIndex="61" FieldLabel="Combo2" Width="250"
DisplayField="Value" AnchorHorizontal="100%" QueryMode="Local" AutoDataBind="true"
EnableKeyEvents="true" Editable="true" ForceSelection="true">
<Store>
<ext:Store runat="server">
<Model>
<ext:Model runat="server">
<Fields>
<ext:ModelField Name="Key" />
<ext:ModelField Name="Value" />
</Fields>
</ext:Model>
</Model>
</ext:Store>
</Store>
<Listeners>
</Listeners>
</ext:ComboBox>
</Items>
<Listeners>
<AfterRender Handler="getData();" />
</Listeners>
</ext:Window>
</body>
</html>

Daniil
Aug 30, 2012, 6:24 AM
Hi,

I would set up

AutoLoad="false"
for the both Stores to fix it.