Nov 05, 2012, 11:03 AM
[CLOSED] Rest proxy load and autoload
Hey guys.
i have a question, why is it that when you put a rest / ajax proxy on a datastore it will call store load before after render..?
i know that a proxy will call the url specified when the grid is being initialized, but is there no way to control when the read method should be called..?
suppose i have to call store.load after my grid has put in the ui tree, thous needing the gridID after it has been created since i cant retrive the grid on its ID before it has been created.
my datastore is set to autoload = false. so in teory the store should not load until my method is being called..
does anybody know if the flow for a proxy differs for a datastore so you dont have any control over when you call store.load()..?
Ex.
this should be call as the first method before my proxy read is called
Akpenob..
i have a question, why is it that when you put a rest / ajax proxy on a datastore it will call store load before after render..?
i know that a proxy will call the url specified when the grid is being initialized, but is there no way to control when the read method should be called..?
suppose i have to call store.load after my grid has put in the ui tree, thous needing the gridID after it has been created since i cant retrive the grid on its ID before it has been created.
my datastore is set to autoload = false. so in teory the store should not load until my method is being called..
does anybody know if the flow for a proxy differs for a datastore so you dont have any control over when you call store.load()..?
Ex.
this should be call as the first method before my proxy read is called
LIA.Administration.grid.AfterRender = function (grid) {
grid.getStore().load();
}
this is called insted af the method above and as a result the grid variable is null..
LIA.grid.gridGetKeyValuesSingle = function (grid) {
var tGrid = Ext.getCmp(grid);
if (tGrid == null) return {};
if (tGrid.keyValues != undefined) {
return tGrid.keyValues;
}
return {};
};
Datastore Initializationpublic void BuildStore(bool isPaging)
{
var pageSize = 50;
this.dataStore = new Store()
{
ID = this.ID + "_store",
IsPagingStore = isPaging,
PageSize = pageSize,
AutoDestroy = true,
RemoteFilter = true,
RemoteSort = true,
RemotePaging = true,
AutoSync = false,
Model =
{
new Model()
{
IDProperty = ""
}
},
};
this.Store.Add(dataStore);
}
Rest Proxy initialization
public void BuildProxy()
{
this.proxy = new AjaxProxy();
JsonReader reader = new JsonReader()
{
Root = "rows",
TotalProperty = "totalCount",
// IDProperty = "ID",
SuccessProperty = "success",
MessageProperty = "message",
};
JsonWriter writer = new JsonWriter()
{
WriteAllFields = true,
Encode = true,
Root = "rows",
};
proxy.Reader.Add(reader);
proxy.Writer.Add(writer);
this.dataStore.Proxy.Add(proxy);
}
"proxy" is the variable for my datastores Rest proxy
public void SetReadMethod(object bClass, String method)
{
this.proxy.API.Read = LiaMethod.GetDirectMethod(bClass, method);
this.proxy.ExtraParams.Add(new Parameter("keys", "LIA.grid.gridGetKeyValuesSingle ('" + this.ID + "')", ParameterMode.Raw));
}
Best regardAkpenob..
Last edited by Daniil; Nov 06, 2012 at 5:51 AM.
Reason: [CLOSED]