RE: Ext.Net Store.loadData
Hello, cleve!
I think I can help if you let me see at the rest part of you code to reproduce the errors you mentioned.
RE: Ext.Net Store.loadData
Hi again.This code looks a little bit strange.
Code:
TwoStoreResponseData msData = new TwoStoreResponseData();
msData.Total = qMappings.Count();
msData.Data = JSON.Serialize(qMappings.ToList());
store.LoadData(msData.ToString(), true);
Try to replace this by the following code.
Code:
store.DataSource = qMappings.ToList();
store.DataBind();
Did it help you?
P.S. It seems the Help forum is more appropriate for this topic than the Bugs forum.
RE: Ext.Net Store.loadData
Hi Daniil,
Thanks for your reply. The code you appended works fine if I erase the reader settings (Root and TotalProperty). I think I have serval points to add on this post for the reason why I think it is more likely a bug.
The class definition which you can find as "TwoStoreReponseData" is a sub-class derived from "StoreResponseData" whose "ToString()" function produces a Json format with root name "data" and "total" property. StoreReponseData is a usful class I use in the project to generate Json-based MVC action results (transmitting a zipped store data).
That's why I want to generalize this format to let the rest of my store definitions confine with this usage convention.
- On previous version (0.8.2) afore server-side script works fine and the rendered JS scripts are correctly mapped to store.loadData(jsonObject, isAppended). But 1.0 version renders another format which is store.loadData(jsonString, isAppended). To translate jsonString to jsonObject, I think a wrap "Ext.decode()" is required. If not, reader's getRoot function will generate an error. That's the one I mentioned at the original post saying some errors occurred.
- At 1.0 version, StoreReponseData.ToString() changed the totalProperty name which is from "totalCount" to "total". Other implementation of it remains the same. So when I changed the way I initialize the store with the following:
Code:
// Your solution
// store.DataSource = qMappings.ToList();
// store.DataBind();
store.AutoLoad = true;
store.SetDataFromJson(msData.ToString());
It works fine! That means the Json format is still accepted by the store and reader definition.
- Furtherly when I double check the way DataBind or SetDataFromJson, I found they use different mapping to client-side JS script render, comparing with LoadData. They both use Ext.data.PagingMemoryProxy to create a Json block proxy for reader to read.
So in conclusion, StoreReponseData is producing a correct Json string and Store reader still accept the way to read the string if reader and root are correctly specified. Problematic is LoadData, which is at server-side should render a client-side loadData function without quoting the string object put to server-side function call.
RE: Ext.Net Store.loadData
Hello, cleve!
Maybe you are right, maybe not:) I think the creators of this toolkit can answer on this question - it's a bug or not? Perhaps, they have already answered on it because this topic is moved to Help from Bug forum:)