title: subarray models mapping issues with gridpanel extjs 4
body: <p>stackoverflow team member I am having problem with displaying the json subarray data to my gridpanel my json data is below</p>
  
  <pre><code>{
      "total": 11,
      "success": true,
      "employeetaskdetdata": [{
          "subject": "Work in progress",
          "employee": {
              "username": "yogen",
              "designation": {
                  "department": {
                      "company": {
                          "cmpname": "Kintu Designs Pvt ltd",
                          "cmptitle": "Kintu Designs Pvt ltd",
                          "cmpdesc": "&lt;b&gt;D-104 Toral Appartment Surat,&lt;br&gt;Timalyabad.&lt;/b&gt;",
                          "cmpfax": "8128812153",
                          "cmpcontact": "8128812153",
                          "cmpwebsite": "www.kintudesigns.com",
                          "cmpemail1": "yaryan997@gmail.com",
                          "cmpemail2": "yaryan997@gmail.com",
                          "cmpcountry": "India",
                          "cmpstate": "Gujarat",
                          "cmpcity": "Surat",
                          "cmpaddress": "D-104 Toral Appartment Surat,\nTimalyabad.",
                          "cmplogo": "calendar.png",
                          "cmplogopath": "upload/images/",
                          "cmpcreatedby": 1,
                          "cmpcreatedon": 1335764510000,
                          "cmpmodifiedon": 1335764510000,
                          "cmpmodifiedby": 0,
                          "id": 1
                      },
                      "departname": "Programmer",
                      "createdby": 1,
                      "createdon": 1335764655000,
                      "modifiedby": 1,
                      "modifiedon": 1335764655000,
                      "departdescr": "&lt;b&gt;?Programmer&lt;/b&gt;",
                      "id": 2
                  },
                  "createdby": 1,
                  "createdon": 1335764825000,
                  "modifiedby": 1,
                  "modifiedon": 1335764825000,
                  "designame": "Senior JAVA Programmer",
                  "desigdescr": "&lt;b&gt;?Senior JAVA Programmer&lt;/b&gt;",
                  "id": 6
              },
              "createdby": 1,
              "createdon": 1335765074000,
              "modifiedby": 1,
              "modifiedon": 1335765074000,
              "dateofbirth": 1335810600000,
              "joindate": 1337106600000,
              "firstname": "Yogendra",
              "surname": "Singh",
              "gender": "M",
              "marital": "U",
              "nationality": "",
              "contactno": "",
              "mobileno": "",
              "email": "",
              "otheremail": "",
              "fathername": "",
              "mothername": "",
              "accountno": "",
              "salary": "",
              "bank": {
                  "bankname": "ICICI Bank",
                  "bankaddress": "ICICI Bank Nanpura",
                  "id": 1
              },
              "address": "",
              "id": 6,
              "password": "123"
          },
          "todaysdate": "2012-05-05",
          "createdby": 6,
          "createdon": 1336203851000,
          "modifiedby": 6,
          "modifiedon": 1336203851000,
          "project": {
              "company": {
                  "cmpname": "Kintu Designs Pvt ltd",
                  "cmptitle": "Kintu Designs Pvt ltd",
                  "cmpdesc": "&lt;b&gt;D-104 Toral Appartment Surat,&lt;br&gt;Timalyabad.&lt;/b&gt;",
                  "cmpfax": "8128812153",
                  "cmpcontact": "8128812153",
                  "cmpwebsite": "www.kintudesigns.com",
                  "cmpemail1": "yaryan997@gmail.com",
                  "cmpemail2": "yaryan997@gmail.com",
                  "cmpcountry": "India",
                  "cmpstate": "Gujarat",
                  "cmpcity": "Surat",
                  "cmpaddress": "D-104 Toral Appartment Surat,\nTimalyabad.",
                  "cmplogo": "calendar.png",
                  "cmplogopath": "upload/images/",
                  "cmpcreatedby": 1,
                  "cmpcreatedon": 1335764510000,
                  "cmpmodifiedon": 1335764510000,
                  "cmpmodifiedby": 0,
                  "id": 1
              },
              "createdby": 1,
              "createdon": 1335765435000,
              "modifiedby": 1,
              "modifiedon": 1335765435000,
              "projectname": "Project I",
              "projecttitle": "Project I",
              "projectdesc": "&lt;b&gt;Kintu Design Pvt ltd new Project I&lt;/b&gt;",
              "projectstart": 1335810600000,
              "projectend": 1336761000000,
              "id": 1
          },
          "task": {
              "duration": 4.0,
              "employee": [{
                  "username": "hiren",
                  "designation": {
                      "department": {
                          "company": {
                              "cmpname": "Kintu Designs Pvt ltd",
                              "cmptitle": "Kintu Designs Pvt ltd",
                              "cmpdesc": "&lt;b&gt;D-104 Toral Appartment Surat,&lt;br&gt;Timalyabad.&lt;/b&gt;",
                              "cmpfax": "8128812153",
                              "cmpcontact": "8128812153",
                              "cmpwebsite": "www.kintudesigns.com",
                              "cmpemail1": "yaryan997@gmail.com",
                              "cmpemail2": "yaryan997@gmail.com",
                              "cmpcountry": "India",
                              "cmpstate": "Gujarat",
                              "cmpcity": "Surat",
                              "cmpaddress": "D-104 Toral Appartment Surat,\nTimalyabad.",
                              "cmplogo": "calendar.png",
                              "cmplogopath": "upload/images/",
                              "cmpcreatedby": 1,
                              "cmpcreatedon": 1335764510000,
                              "cmpmodifiedon": 1335764510000,
                              "cmpmodifiedby": 0,
                              "id": 1
                          },
                          "departname": "Programmer",
                          "createdby": 1,
                          "createdon": 1335764655000,
                          "modifiedby": 1,
                          "modifiedon": 1335764655000,
                          "departdescr": "&lt;b&gt;?Programmer&lt;/b&gt;",
                          "id": 2
                      },
                      "createdby": 1,
                      "createdon": 1335764755000,
                      "modifiedby": 1,
                      "modifiedon": 1335764755000,
                      "designame": "Senior PHP Programmer",
                      "desigdescr": "&lt;b&gt;?Senior PHP Programmer&lt;/b&gt;",
                      "id": 3
                  },
                  "createdby": 1,
                  "createdon": 1335765018000,
                  "modifiedby": 1,
                  "modifiedon": 1335765018000,
                  "dateofbirth": null,
                  "joindate": null,
                  "firstname": "Hiren",
                  "surname": "Patel",
                  "gender": "M",
                  "marital": "U",
                  "nationality": "",
                  "contactno": "",
                  "mobileno": "",
                  "email": "",
                  "otheremail": "",
                  "fathername": "",
                  "mothername": "",
                  "accountno": "",
                  "salary": "",
                  "bank": {
                      "bankname": "ICICI Bank",
                      "bankaddress": "ICICI Bank Nanpura",
                      "id": 1
                  },
                  "address": "",
                  "id": 4,
                  "password": "123"
              }, {
                  "username": "yogen",
                  "designation": {
                      "department": {
                          "company": {
                              "cmpname": "Kintu Designs Pvt ltd",
                              "cmptitle": "Kintu Designs Pvt ltd",
                              "cmpdesc": "&lt;b&gt;D-104 Toral Appartment Surat,&lt;br&gt;Timalyabad.&lt;/b&gt;",
                              "cmpfax": "8128812153",
                              "cmpcontact": "8128812153",
                              "cmpwebsite": "www.kintudesigns.com",
                              "cmpemail1": "yaryan997@gmail.com",
                              "cmpemail2": "yaryan997@gmail.com",
                              "cmpcountry": "India",
                              "cmpstate": "Gujarat",
                              "cmpcity": "Surat",
                              "cmpaddress": "D-104 Toral Appartment Surat,\nTimalyabad.",
                              "cmplogo": "calendar.png",
                              "cmplogopath": "upload/images/",
                              "cmpcreatedby": 1,
                              "cmpcreatedon": 1335764510000,
                              "cmpmodifiedon": 1335764510000,
                              "cmpmodifiedby": 0,
                              "id": 1
                          },
                          "departname": "Programmer",
                          "createdby": 1,
                          "createdon": 1335764655000,
                          "modifiedby": 1,
                          "modifiedon": 1335764655000,
                          "departdescr": "&lt;b&gt;?Programmer&lt;/b&gt;",
                          "id": 2
                      },
                      "createdby": 1,
                      "createdon": 1335764825000,
                      "modifiedby": 1,
                      "modifiedon": 1335764825000,
                      "designame": "Senior JAVA Programmer",
                      "desigdescr": "&lt;b&gt;?Senior JAVA Programmer&lt;/b&gt;",
                      "id": 6
                  },
                  "createdby": 1,
                  "createdon": 1335765074000,
                  "modifiedby": 1,
                  "modifiedon": 1335765074000,
                  "dateofbirth": 1335810600000,
                  "joindate": 1337106600000,
                  "firstname": "Yogendra",
                  "surname": "Singh",
                  "gender": "M",
                  "marital": "U",
                  "nationality": "",
                  "contactno": "",
                  "mobileno": "",
                  "email": "",
                  "otheremail": "",
                  "fathername": "",
                  "mothername": "",
                  "accountno": "",
                  "salary": "",
                  "bank": {
                      "bankname": "ICICI Bank",
                      "bankaddress": "ICICI Bank Nanpura",
                      "id": 1
                  },
                  "address": "",
                  "id": 6,
                  "password": "123"
              }],
              "createdby": 1,
              "createdon": 1336460152000,
              "modifiedby": 1,
              "modifiedon": 1336460152000,
              "project": {
                  "company": {
                      "cmpname": "Kintu Designs Pvt ltd",
                      "cmptitle": "Kintu Designs Pvt ltd",
                      "cmpdesc": "&lt;b&gt;D-104 Toral Appartment Surat,&lt;br&gt;Timalyabad.&lt;/b&gt;",
                      "cmpfax": "8128812153",
                      "cmpcontact": "8128812153",
                      "cmpwebsite": "www.kintudesigns.com",
                      "cmpemail1": "yaryan997@gmail.com",
                      "cmpemail2": "yaryan997@gmail.com",
                      "cmpcountry": "India",
                      "cmpstate": "Gujarat",
                      "cmpcity": "Surat",
                      "cmpaddress": "D-104 Toral Appartment Surat,\nTimalyabad.",
                      "cmplogo": "calendar.png",
                      "cmplogopath": "upload/images/",
                      "cmpcreatedby": 1,
                      "cmpcreatedon": 1335764510000,
                      "cmpmodifiedon": 1335764510000,
                      "cmpmodifiedby": 0,
                      "id": 1
                  },
                  "createdby": 1,
                  "createdon": 1335765435000,
                  "modifiedby": 1,
                  "modifiedon": 1335765435000,
                  "projectname": "Project I",
                  "projecttitle": "Project I",
                  "projectdesc": "&lt;b&gt;Kintu Design Pvt ltd new Project I&lt;/b&gt;",
                  "projectstart": 1335810600000,
                  "projectend": 1336761000000,
                  "id": 1
              },
              "percentdone": 55,
              "durationunit": "d",
              "startdate": 1336415400000,
              "parentid": 2,
              "taskindex": 0,
              "taskname": "Sub Task 2 1",
              "enddate": 1336761000000,
              "priority": 2,
              "id": 3,
              "depth": 2
          },
          "percentdone": 20,
          "totalworkedhrs": -9.5,
          "starttime": "09:00:00",
          "finishtime": "00:00:00",
          "id": 1,
          "description": "&lt;b&gt;Work in progress&lt;/b&gt;",
          "hours": 0,
          "minutes": 30
      }, {
          "subject": "Work in progresss",
          "employee": {
              "username": "yogen",
              "designation": {
                  "department": {
                      "company": {
                          "cmpname": "Kintu Designs Pvt ltd",
                          "cmptitle": "Kintu Designs Pvt ltd",
                          "cmpdesc": "&lt;b&gt;D-104 Toral Appartment Surat,&lt;br&gt;Timalyabad.&lt;/b&gt;",
                          "cmpfax": "8128812153",
                          "cmpcontact": "8128812153",
                          "cmpwebsite": "www.kintudesigns.com",
                          "cmpemail1": "yaryan997@gmail.com",
                          "cmpemail2": "yaryan997@gmail.com",
                          "cmpcountry": "India",
                          "cmpstate": "Gujarat",
                          "cmpcity": "Surat",
                          "cmpaddress": "D-104 Toral Appartment Surat,\nTimalyabad.",
                          "cmplogo": "calendar.png",
                          "cmplogopath": "upload/images/",
                          "cmpcreatedby": 1,
                          "cmpcreatedon": 1335764510000,
                          "cmpmodifiedon": 1335764510000,
                          "cmpmodifiedby": 0,
                          "id": 1
                      },
                      "departname": "Programmer",
                      "createdby": 1,
                      "createdon": 1335764655000,
                      "modifiedby": 1,
                      "modifiedon": 1335764655000,
                      "departdescr": "&lt;b&gt;?Programmer&lt;/b&gt;",
                      "id": 2
                  },
                  "createdby": 1,
                  "createdon": 1335764825000,
                  "modifiedby": 1,
                  "modifiedon": 1335764825000,
                  "designame": "Senior JAVA Programmer",
                  "desigdescr": "&lt;b&gt;?Senior JAVA Programmer&lt;/b&gt;",
                  "id": 6
              },
              "createdby": 1,
              "createdon": 1335765074000,
              "modifiedby": 1,
              "modifiedon": 1335765074000,
              "dateofbirth": 1335810600000,
              "joindate": 1337106600000,
              "firstname": "Yogendra",
              "surname": "Singh",
              "gender": "M",
              "marital": "U",
              "nationality": "",
              "contactno": "",
              "mobileno": "",
              "email": "",
              "otheremail": "",
              "fathername": "",
              "mothername": "",
              "accountno": "",
              "salary": "",
              "bank": {
                  "bankname": "ICICI Bank",
                  "bankaddress": "ICICI Bank Nanpura",
                  "id": 1
              },
              "address": "",
              "id": 6,
              "password": "123"
          },
          "todaysdate": "2012-05-05",
          "createdby": 6,
          "createdon": 1336204557000,
          "modifiedby": 6,
          "modifiedon": 1336204557000,
          "project": {
              "company": {
                  "cmpname": "Kintu Designs Pvt ltd",
                  "cmptitle": "Kintu Designs Pvt ltd",
                  "cmpdesc": "&lt;b&gt;D-104 Toral Appartment Surat,&lt;br&gt;Timalyabad.&lt;/b&gt;",
                  "cmpfax": "8128812153",
                  "cmpcontact": "8128812153",
                  "cmpwebsite": "www.kintudesigns.com",
                  "cmpemail1": "yaryan997@gmail.com",
                  "cmpemail2": "yaryan997@gmail.com",
                  "cmpcountry": "India",
                  "cmpstate": "Gujarat",
                  "cmpcity": "Surat",
                  "cmpaddress": "D-104 Toral Appartment Surat,\nTimalyabad.",
                  "cmplogo": "calendar.png",
                  "cmplogopath": "upload/images/",
                  "cmpcreatedby": 1,
                  "cmpcreatedon": 1335764510000,
                  "cmpmodifiedon": 1335764510000,
                  "cmpmodifiedby": 0,
                  "id": 1
              },
              "createdby": 1,
              "createdon": 1335765435000,
              "modifiedby": 1,
              "modifiedon": 1335765435000,
              "projectname": "Project I",
              "projecttitle": "Project I",
              "projectdesc": "&lt;b&gt;Kintu Design Pvt ltd new Project I&lt;/b&gt;",
              "projectstart": 1335810600000,
              "projectend": 1336761000000,
              "id": 1
          },
          "task": {
              "duration": 4.0,
              "employee": [{
                  "username": "hiren",
                  "designation": {
                      "department": {
                          "company": {
                              "cmpname": "Kintu Designs Pvt ltd",
                              "cmptitle": "Kintu Designs Pvt ltd",
                              "cmpdesc": "&lt;b&gt;D-104 Toral Appartment Surat,&lt;br&gt;Timalyabad.&lt;/b&gt;",
                              "cmpfax": "8128812153",
                              "cmpcontact": "8128812153",
                              "cmpwebsite": "www.kintudesigns.com",
                              "cmpemail1": "yaryan997@gmail.com",
                              "cmpemail2": "yaryan997@gmail.com",
                              "cmpcountry": "India",
                              "cmpstate": "Gujarat",
                              "cmpcity": "Surat",
                              "cmpaddress": "D-104 Toral Appartment Surat,\nTimalyabad.",
                              "cmplogo": "calendar.png",
                              "cmplogopath": "upload/images/",
                              "cmpcreatedby": 1,
                              "cmpcreatedon": 1335764510000,
                              "cmpmodifiedon": 1335764510000,
                              "cmpmodifiedby": 0,
                              "id": 1
                          },
                          "departname": "Programmer",
                          "createdby": 1,
                          "createdon": 1335764655000,
                          "modifiedby": 1,
                          "modifiedon": 1335764655000,
                          "departdescr": "&lt;b&gt;?Programmer&lt;/b&gt;",
                          "id": 2
                      },
                      "createdby": 1,
                      "createdon": 1335764755000,
                      "modifiedby": 1,
                      "modifiedon": 1335764755000,
                      "designame": "Senior PHP Programmer",
                      "desigdescr": "&lt;b&gt;?Senior PHP Programmer&lt;/b&gt;",
                      "id": 3
                  },
                  "createdby": 1,
                  "createdon": 1335765018000,
                  "modifiedby": 1,
                  "modifiedon": 1335765018000,
                  "dateofbirth": null,
                  "joindate": null,
                  "firstname": "Hiren",
                  "surname": "Patel",
                  "gender": "M",
                  "marital": "U",
                  "nationality": "",
                  "contactno": "",
                  "mobileno": "",
                  "email": "",
                  "otheremail": "",
                  "fathername": "",
                  "mothername": "",
                  "accountno": "",
                  "salary": "",
                  "bank": {
                      "bankname": "ICICI Bank",
                      "bankaddress": "ICICI Bank Nanpura",
                      "id": 1
                  },
                  "address": "",
                  "id": 4,
                  "password": "123"
              }]
  }
  </code></pre>
  
  <p>and my model is below</p>
  
  <pre><code>Ext.define('DEV.model.employeetaskdetModel', {
      extend: 'Ext.data.Model',
      fields : [
                { name: 'id'},
                { name: 'taskname', mapping:'task.taskname'},
                { name: 'firstname', mapping: 'employee.firstname'},
                { name: 'employee',type: 'auto'},
                { name: 'percentdone'}
            ]
  });
  </code></pre>
  
  <p>and my grid panel columns are below</p>
  
  <pre><code>columns: [ {
       xtype: 'gridcolumn',
       dataIndex: 'percentdone',
       text: 'Percent Done'
   }, {
       xtype: 'gridcolumn',
       dataIndex: 'firstname',
       text: 'First Name'
   }]
  </code></pre>
  
  <p>I am not able to show the firstname in my gridPanel. But when I change the firstname column with below code it shows me the firstname gridpanel correctly.</p>
  
  <pre><code>{
           xtype: 'gridcolumn',
           dataIndex: 'employee',
           text: 'User Name',
           renderer: function (employee) {
               var result = [];
               employee = employee || [];
               var value = employee.firstname;
               if (value) {
                   result.push(value);
               }
               return result;
               console.log(employee.firstname);
           }
       },
  </code></pre>
  
  <p>please suggest me why my gridpanel didn't show the firstname of user directly. What's the problem with my code. And why its showing the data when I add the renderer function.</p>