PDA

View Full Version : [CLOSED] Example of LocalStorageProxy



alessandra.monica
Oct 23, 2013, 9:03 AM
Hi all,

I would like to manage the content a of a combobox with a LocalStorageProxy, but honestly I haven't understood
very well how to do it. I haven't found any complete example and really it's a bit of mistery at the moment for me.

Can you please provide an example of how I should fill in the values in the combobox?

This is the store:


<ext:Store ID="StatusStore" runat="server">
<Model>
<ext:Model runat="server" ID="statusStoreModel" IDProperty="Id">
<Fields>
<ext:ModelField Name="Id" />
<ext:ModelField Name="Status" />
</Fields>
<Proxy>
<ext:LocalStorageProxy StorageID="mylocalstorage"></ext:LocalStorageProxy>
</Proxy>
</ext:Model>
</Model>

</ext:Store>


This is the combo:



<ext:ComboBox runat="server" ID="SearchStatusComboBox" StoreID="StatusStore" DisplayField="Status" ValueField="Id">
</ext:ComboBox>


but then....what I have to do?

Thank you!!!!

Daniil
Oct 23, 2013, 11:54 AM
Hi Alessandra,

Here is an example.

Example

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

<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>

<!DOCTYPE html>
<html>
<head runat="server">
<title>Ext.NET v2 Example</title>
</head>
<body>
<form runat="server">
<ext:ResourceManager runat="server" />

<ext:Store ID="StatusStore" runat="server">
<Model>
<ext:Model runat="server" ID="statusStoreModel" IDProperty="Id">
<Fields>
<ext:ModelField Name="Id" />
<ext:ModelField Name="Status" />
</Fields>
<Proxy>
<ext:LocalStorageProxy StorageID="mylocalstorage" />
</Proxy>
</ext:Model>
</Model>
</ext:Store>

<ext:Button runat="server" Text="Add one" Handler="App.StatusStore.add({ Id: 'id1', Status: 'status 1'});" />

<ext:Button runat="server" Text="Add another" Handler="App.StatusStore.add({ Id: 'id2', Status: 'status 2'});" />

<ext:ComboBox
runat="server"
StoreID="StatusStore"
DisplayField="Status"
ValueField="Id" />

</form>
</body>
</html>

alessandra.monica
Oct 24, 2013, 6:58 AM
Thank you!!