Apr 09, 2012, 2:24 AM
[CLOSED] Data binding to NetTiers data entity objects
Hi,
I'm trying to bind a GridPanel to a list of NetTiers entity objects deserialized as an array. The GridPanel store gets bound partially - it does have the correct count of rows but the content is not bound properly and the fields remain empty. I examined the example at https://examples1.ext.net/#/GridPane...Field_Mapping/ to get started and played around Mapping property and Column Renderer handler a bit with no results. I think I must be missing the way to drill down the NetTiers object graph to do the binding correctly. Please advise. I realize you may require more information about the structure of the NetTiers objects so let me know. It's pretty linear and doesn't contain other custom objects.
Thanks,
Vadym
I'm trying to bind a GridPanel to a list of NetTiers entity objects deserialized as an array. The GridPanel store gets bound partially - it does have the correct count of rows but the content is not bound properly and the fields remain empty. I examined the example at https://examples1.ext.net/#/GridPane...Field_Mapping/ to get started and played around Mapping property and Column Renderer handler a bit with no results. I think I must be missing the way to drill down the NetTiers object graph to do the binding correctly. Please advise. I realize you may require more information about the structure of the NetTiers objects so let me know. It's pretty linear and doesn't contain other custom objects.
Thanks,
Vadym
<script type="text/javascript">
var idRenderer = function (value) {
//alert(value);
if (!Ext.isEmpty(value)) {
return value.ID;
}
return value;
};
var someNameRenderer = function (value) {
//alert(value);
if (!Ext.isEmpty(value)) {
return value.SomeName;
}
return value;
};
</script>
<ext:Store ID="Store1" runat="server" SerializationMode="Complex">
<Reader>
<ext:JsonReader IDProperty="ID">
<Fields>
<ext:RecordField Name="ID" Type="Int" />
<ext:RecordField Name="SomeName" />
</Fields>
</ext:JsonReader>
</Reader>
</ext:Store>
<ext:GridPanel ID="GridPanel1" EnableViewState="true" AutoHeight="true" runat="server"
StoreID="Store1">
<ColumnModel runat="server">
<Columns>
<ext:Column Header="ID" DataIndex="ID">
<Renderer Fn="idRenderer" />
</ext:Column>
<ext:Column Header="SomeName" DataIndex="SomeName">
<Renderer Fn="someNameRenderer" />
</ext:Column>
</Columns>
</ColumnModel>
</ext:GridPanel>
protected void Page_Load(object sender, EventArgs e)
{
if (!X.IsAjaxRequest)
{
// Initialize the WCF service proxy object
ServiceClient client = new ServiceClient();
MyObject_GetAllRequest req = new MyObject_GetAllRequest();
MyObject_GetAllResponse resp = client.MyObject_GetAll(req);
MyObject[] myObjects = resp.MyObject_GetAllResult;
this.Store1.DataSource = myObjects;
this.Store1.DataBind();
// The actual properties of the MyObject class are encapsulated
// inside the "entityData" object - probably, part of the inner workings of NetTiers ORM
// So, to get a hold of the SomeName field, I'd need to do something like:
MyObject test=myObjects[0];
String someName=test.entityData.SomeName;
}
}
Last edited by Daniil; Apr 09, 2012 at 4:08 PM.
Reason: [CLOSED]