Hi,
The ServerMapping serves for both scenarios, a simple mapping or mapping complex.
Here are two examples:
Simple:
<asp:SqlDataSource ID="SqlDataSource1" runat="server" SelectCommand="select id, nome from usuario" />
<ext:Store ID="Store1" runat="server" DataSourceID="SqlDataSource1" OnRefreshData="Store1_Refresh">
<Reader>
<ext:JsonReader IDProperty="id">
<Fields>
<ext:RecordField Name="id" ServerMapping="id" Type="Int" />
<ext:RecordField Name="nome" ServerMapping="nome" />
</Fields>
</ext:JsonReader>
</Reader>
</ext:Store>
Complex:
create table usuario (
id int identity(1, 1) not null,
nome varchar(30) not null,
id_perfil int not null,
primary key (id)
);
create table perfil (
id int identity(1, 1) not null,
nome varchar(30) not null,
primary key (id)
);
<asp:LinqDataSource ID="LinqDataSource1" runat="server" TableName="usuarios" Select="new (id, nome, perfil)" />
<ext:Store ID="Store1" runat="server" DataSourceID="LinqDataSource1" OnRefreshData="Store1_Refresh">
<Reader>
<ext:JsonReader IDProperty="id">
<Fields>
<ext:RecordField Name="id" ServerMapping="id" Type="Int" />
<ext:RecordField Name="nome" ServerMapping="nome" />
<ext:RecordField Name="perfil" ServerMapping="perfil.nome" />
</Fields>
</ext:JsonReader>
</Reader>
</ext:Store>
With ServerMapping I map my object / attribute with the name and I say as it is called.
This makes it easy. ;)
[]'s
Vinicius