Dec 09, 2009, 6:31 PM
[CLOSED] [1.0] Store adding record
Here is the situation.
I have a store that is on the .aspx page. I add to this store in javascript by creating records for it that a user creates. This store is bound to a GridPanel.
Two questions.
1. When I try to access the Items from the GridPanel via CodeBehind. It is returning a Items.Count of 0.
2. How do I access record information (from codebehind) from the Store?
Here is a very simplified example of what I am doing.
.aspx:
<script language="javascript">
var Manager = {
addItem: function() {
var value = tData.Text;
var tempRecord = Ext.data.Record.create([
{ name: 'DataValue' }
]);
var found = strData.query('DataValue', value, false, false);
if (found.length <= 0) {
var record = new tempRecord({ DataValue: value });
strData.add(record);
}
}
}
</script>
<ext:Store ID="strData" runat="server">
<Reader>
<ext:JsonReader>
<Fields>
<ext:RecordField Name="DataValue" />
</Fields>
</ext:JsonReader>
</Reader>
</ext:Store>
<ext:GridPanel ID="gpGrid" runat="server" StroreID="strData">
<ColumnModel>
<ext:Column ColumnID="DataValue" DataIndex="DataValue" Header="Value" />
</ColumnModel>
</ext:GridPanel>
<ext:TextField ID="tData" runat="server" />
<ext:Button ID="bAdd" runat="server" Text="Add" Icon="Accept">
<Listeners>
<Click Handler="Manager.addItem();" />
</Listeners>
</ext:Button>
<ext:Button ID="bDone" runat="server" Text="Done" Icon="Package">
<DirectEvents>
<Click OnEvent="bDone_Click" />
</DirectEvents>
</ext:Button>
.aspx.cs:protected void bDone_Click(object sender, EventArgs e) {
// TODO: Want to pull data that was dynamically added to grid/store. How?
}
}