Mar 23, 2016, 8:58 AM
Use a Store to send data to a page.
Hello.
I am trying to send the resource file information to the page.
I am using a Store, but on the listener of the store, who call a script on the web page, i can't see the sended information.
I have that code for the store into the cshtml:
Any idea about the problema with the code?
Need more parameters into the cshtml?
Edit: Debuging the script, i can see the variable total count with the number of records i have, but i don't know how to get through the entire list.
I am trying to send the resource file information to the page.
I am using a Store, but on the listener of the store, who call a script on the web page, i can't see the sended information.
I have that code for the store into the cshtml:
X
.Store()
.ID("dsTranslate")
.AutoLoad(true)
.Fields(field =>
{
field.Add("key");
field.Add("value");
}
)
.Listeners(lis =>
{
lis.Load.Fn = "TranslateLoaded";
}
)
.Proxy(p =>
{
p.Add(
X.AjaxProxy()
.Url("/extnet/Translate")
);
}
)
The controller code for method /extnet/Translate: public StoreResult Translate()
{
var lang = "es-ES";
if (Request.Cookies.Count > 0)
lang = Request.Cookies["cultureCode"].Value;
CultureInfo cult = Thread.CurrentThread.CurrentCulture;
try
{
cult = new CultureInfo(lang);
}
catch (Exception ex) { }
ResourceSet res = Resources.ResourceAdministracion.ResourceManager.GetResourceSet(cult, true, false);
IDictionaryEnumerator trav = res.GetEnumerator();
Dictionary<string, string> dict = new Dictionary<string, string>();
while (trav.MoveNext())
{
if (trav.Key.ToString().Length > 2)
dict.Add(trav.Key.ToString(), trav.Value.ToString());
}
var q = from c in dict
select new { key = c.Key, value = c.Value };
return new StoreResult(q, dict.Count);
}
and the sript where i can't retrive the information sended by the controller store result.var TranslateLoaded = function (objGrid, gridRecords, objOptions) {
for (var i = 0; i < gridRecords.length; i++) {
}
}
The object gridRecords have only one Ã*tem, but i send 12 or more into the storeresult.Any idea about the problema with the code?
Need more parameters into the cshtml?
Edit: Debuging the script, i can see the variable total count with the number of records i have, but i don't know how to get through the entire list.
Last edited by sishco; Mar 23, 2016 at 9:29 AM.