PDA

View Full Version : [CLOSED] Store error 'Please define Reader for the Proxy (store's Reader is used if proxy is undefined)'



ViDom
May 06, 2013, 11:24 AM
Hi,
Here is my configuration of store for combobox remote loading by handler:


store = new Ext.Net.Store {ID = this.ID + "_Store"};
Ext.Net.JsonReader reader = new JsonReader {TotalProperty = "TotalRecords",Root = "data",IDProperty = "Id"};
Ext.Net.ComboBox combo = new Ext.Net.ComboBox();
combo.DisplayField = "Name";
combo.ValueField = "Id";
combo.EmptyText = "-- empty --";
combo.EmptyValue = 0;
combo.ForceSelection = true;
combo.Editable = true;
combo.TypeAhead = false;
combo.ListConfig = new BoundList {LoadingText = "Loading..."};
combo.MinChars = 1;
Model model = new Model();
model.Fields.AddRange(new List<ModelField> { new ModelField("Id", ModelFieldType.Int), new ModelField("Name", ModelFieldType.String) });
store.Model.Add(model);
//DataSorter dataSorter = new DataSorter {Property = "Name", Direction = SortDirection.ASC};
//store.Sorters.Add(dataSorter);
Ext.Net.AjaxProxy proxy = new Ext.Net.AjaxProxy {Url = "~/ComboHandler.ashx"};
proxy.ActionMethods.Read = HttpMethod.POST;
proxy.Timeout = 120000;
proxy.Reader.Add(reader);// here I have add Reader for proxy
store.Proxy.Add(proxy);
store.AutoLoad = false;
store.RemoteSort = true;
store.Reader.Add(reader);
combo.TriggerAction = TriggerAction.All;
}
store.WarningOnDirty = false;
combo.Store.Add(store);


So I add Reader to proxy and still getting this exception.
Am I doing something wrong?

Thanks,
ViDom

Vladimir
May 06, 2013, 11:30 AM
Just remove


store.Reader.Add(reader);

ViDom
May 06, 2013, 11:34 AM
Just remove


store.Reader.Add(reader);


I just missed it. Could you please explain then when should I add reader to store?

Daniil
May 06, 2013, 12:52 PM
Could you please explain then when should I add reader to store?

If a Store has no Proxy.