PDA

View Full Version : [CLOSED] Problem to create a store in code behind.



feanor91
Jan 24, 2013, 7:27 AM
Hello

I will try to create code behind control with tab, panel grid...and a store for the grid.

All works fine until I came to the store.

I inspire mysel from the Ext.Net book and use a .ashx page to create all the mess.

Problem is my store came back from server with a memory proxy.

Here how I create the store:



Dim ProxyConfig As New AjaxProxy.Config

Dim ReaderStatus As New JsonReader
With ReaderStatus
.Root = "data"
End With
With ProxyConfig
.Url = "jsonDAL/returnJSONHistoriqueStatus.aspx?RMA=" + STR_RMA
.Timeout = 300000000
.Reader.Add(ReaderStatus)
End With
Dim StoreStatus As New Store
Dim ProxyStatus As AjaxProxy = New AjaxProxy(ProxyConfig)
Dim ModelFieldStatus As New Model

ModelFieldStatus.Name = "Model_" + STR_RMA
ModelFieldStatus.Fields.Add("STR_Title")
ModelFieldStatus.Fields.Add("STR_Status")
ModelFieldStatus.Fields.Add("STR_Tech")
ModelFieldStatus.Fields.Add("STR_DateMajStatus")
ModelFieldStatus.Fields.Add("STR_Comment")

With StoreStatus
.ID = "Store_" + STR_RMA
.Model.Add(ModelFieldStatus)
.SetProxy(ProxyStatus)
End With


And here what I get from server (only the store definition here):


{store:
{model:Ext.define("Model_33841",
{extend: "Ext.data.Model",
fields:[{name:"STR_Title"},
{name:"STR_Status"},
{name:"STR_Tech"},
{name:"STR_DateMajStatus"},
{name:"STR_Comment"}] }),
storeId:"Store_33841",
autoLoad:true,
proxy:{type:'memory'}
}
}

What I miis on that?

Daniil
Jan 24, 2013, 8:07 AM
Hi @feanor91,

Please try:

.Proxy.Add(ProxyStatus)
instead of

.SetProxy(ProxyStatus)

The SetProxy is a method for already a rendered Store.

feanor91
Jan 24, 2013, 8:14 AM
You'r a king man, it works very well, thanks