ext:ModelField Mapping attribute not working

  1. #1

    ext:ModelField Mapping attribute not working

    <Proxy>
    <ext:AjaxProxy Url="/somepath">
    <Reader>
    <ext:JsonReader Root="data"/>
    </Reader>
    </ext:AjaxProxy>
    </Proxy>
    <Model>
    <ext:Model runat="server">
    <Fields>
    <ext:ModelField Name="data1" Type="Int"/>
    <ext:ModelField Name="data2" />
    <ext:ModelField Name="data3" />
    <ext:ModelField Name="complexObj" IsComplex="true" />
    <ext:ModelField Name="data4" Mapping="complexObj.data4" Type="Int"/>

    </Fields>
    </ext:Model>
    </Model>

    Even though the data is getting into the store - which I confirmed with Chrome - I am getting a value of 0 for the data4. I am putting data1, data2 and data3 into a form and that is working ok.

    Here is the grid defn:

    <ext:GridPanel ID="DetailGrid" runat="server" Region="South" Layout="FitLayout"
    StoreID="Store1" Title="Detail" AutoScroll="true" Split="true">

    <ColumnModel runat="server">
    <Columns>

    <ext:Column ID="Data4" runat="server" Text="Data 4" DataIndex="data4" />

    </Columns>
    </ColumnModel>

    </ext:GridPanel>

    All the examples I have looked at can't find anything wrong with the code.
    Thanks.
  2. #2
    1. IsComplex has no sense if you use Ajaxproxy
    2. Mapping="complexObj.data4" - please provide response with data
  3. #3
    Quote Originally Posted by Vladimir View Post
    1. IsComplex has no sense if you use Ajaxproxy
    2. Mapping="complexObj.data4" - please provide response with data
    Ok on #1 -

    public class data {
    public string data1 {get; set;}
    public string data2 {get; set;}
    public string data3 {get; set;}
    public List<AnotherClass> complexObj {get; set;}
    }

    public class AnotherClass
    {
    public string data4 {get; set;}
    }

    I want to display the data from complexObj into a grid.

    I did find out one thing if I change <ext:ModelField Name="data4" Mapping="complexObj.data4"/> to <ext:ModelField Name="data4" Mapping="complexObj[0].data4"/> I get the data - however I want to display the entire list. So maybe I just have to use a Dataview instead of a grid?

    Thanks,
    Last edited by jbarbeau; Aug 28, 2012 at 6:57 PM.
  4. #4
    complexObj is collection therefore you cannot use 'complexObj.data4'

    Replace it by 'complexObj[0].data4' or don't use List
    public AnotherClass complexObj {get; set;}
  5. #5
    Quote Originally Posted by Vladimir View Post
    complexObj is collection therefore you cannot use 'complexObj.data4'

    Replace it by 'complexObj[0].data4' or don't use List
    public AnotherClass complexObj {get; set;}
    I solved it by using an ext:DataView. Thanks!
  6. #6

    complex types

    Quote Originally Posted by jbarbeau View Post
    I solved it by using an ext:DataView. Thanks!
    I am just curious how you solved it with DataView

Similar Threads

  1. Replies: 3
    Last Post: Jul 17, 2012, 1:44 PM
  2. ListFilter_Remote with Mapping
    By howardyin in forum 2.x Help
    Replies: 0
    Last Post: Apr 28, 2012, 4:03 AM
  3. [CLOSED] RecordField vs ModelField and Reconfigure vs Render
    By Sevilay Tanış in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Mar 13, 2012, 3:20 PM
  4. Replies: 2
    Last Post: Feb 16, 2011, 8:36 AM
  5. Editor Field Mapping not working in MVC2?
    By paxos in forum 1.x Help
    Replies: 4
    Last Post: Apr 27, 2010, 11:03 AM

Tags for this Thread

Posting Permissions