PDA

View Full Version : [CLOSED] ComboBox - Store - no Items



ontiv
Apr 24, 2013, 1:27 PM
Hello,

i have a comboBox with a store and AjaxProxy. After autoload the combobox don't show items. Why ?

.aspx


<ext:ComboBox ID="ComboBox1" runat="server" DisplayField="Name" ValueField="ID" AnchorHorizontal="100%" FieldLabel="Test">
<Store>
<ext:Store ID="st_space_members" runat="server" AutoLoad="true">
<Proxy>
<ext:AjaxProxy Url="~/Space/GetSpaceMembersBySearch">
<Reader>
<ext:JsonReader Root="ID" TotalProperty="total" />
</Reader>
</ext:AjaxProxy>
</Proxy>
<Model>
<ext:Model ID="Model1" runat="server">
<Fields>
<ext:ModelField Name="ID" />
<ext:ModelField Name="Name" />
</Fields>
</ext:Model>
</Model>
</ext:Store>
</Store>
</ext:ComboBox>


ControllerAction


public StoreResult GetSpaceMembersBySearch()
{
//The Code with the result

}

Thanks for help!

Vladimir
Apr 24, 2013, 1:47 PM
Why Root="ID" in JsonReader? Please post a response of GetSpaceMembersBySearch action

ontiv
Apr 24, 2013, 1:56 PM
Why Root="ID" in JsonReader?
I don't know, is this wrong ??





public StoreResult GetSpaceMembersBySearch()
{
//.....

var test = l_members.Select(s => new { ID = s.user_id.ToString(), Name = AccountController.GetUserByID(s.user_id).user_name }).ToList();

result = new StoreResult(test, test.Count);

return result
}

Vladimir
Apr 24, 2013, 2:08 PM
Root is name of property which contains data for parsing


The name of the property which contains the data items corresponding to the Model(s) for which this Reader is configured. For JSON reader it's a property name (or a dot-separated list of property names if the root is nested). For XML reader it's a CSS selector. For Array reader the root is not applicable since the data is assumed to be a single-level array of arrays.
By default the natural root of the data will be used: the root JSON array, the root XML element, or the array.
The data packet value for this property should be an empty array to clear the data or show no data.


By default, root equals 'data' if StoreResult is used, see
http://mvc.ext.net/#/Form_ComboBox/Ajax_Linked_Combos/