Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8980789
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T20:10:26+00:00 2026-06-15T20:10:26+00:00

Using Ext JS 4.1…. I have a grid that displays a bunch of Model

  • 0

Using Ext JS 4.1….

I have a grid that displays a bunch of Model instances, although only some of the fields are displayed. I then have a double-click listener where I would like to load the entire record into a form for editing. In the double-click listener I do not see the data in my hasMany association although the json data is being returned according to Firebug’s Net display where I see the response from the server call. Is there something wrong with my model or am I going about this wrong?

Request.js

Ext.define('Request', {
    extend: 'Ext.data.Model',
    requires: ['PointOfContact'],
    fields: [
       {name: 'id', type: 'int'},
       {name: 'project', type: 'string'},
       {name: 'purpose', type: 'string'},
       {name: 'status'},
       {name: 'additionalInfo', type: 'string'}
    ],
    hasMany: [{
       model: 'PointOfContact',
       name: 'pointOfContacts',
       foreignKey: 'id',
       associationKey: 'pointOfContacts'
   }],
   proxy: {
      type: 'rest',
      url: '/web/project/rest/request/',
      reader: { type: 'json' },
      writer: { type: 'json' }
   }
});

PointOfContact.js

Ext.define('PointOfContact', {
  extend: 'Ext.data.Model',
  fields: [
    {name: 'id', type: 'int'},
    {name: 'fullName', type: 'string'},
    {name: 'email', type: 'string'},
    {name: 'phone', type: 'string'}
  ]
});

Requests.js

Ext.define('Requests', {
  extend: 'Ext.data.Store',
  model: 'Request',
  autoLoad: true
});

RequestsView.js

Ext.define('RequestsView', {
  extend: 'Ext.grid.Panel',
  title: 'All Requests',
  store: 'Requests',
  viewConfig: {
     singleSelect: 'true',
     listeners: {
     itemdblclick: function(dataview, record, item, index, e) {
        console.log(record.get('project'));
        console.log(record.get('purpose'));
        console.log(record.get('status'));
        console.log(record.get('additionalInfo'));
        console.log(record.get('pointOfContacts'));
        var comp = Ext.ComponentQuery.query('requestForm');
        comp[0].getForm().loadRecord(record);
        var mainPanel = Ext.ComponentQuery.query('mainpanel');
        mainPanel[0].getLayout().setActiveItem('requestForm');
        }
      }
    },
   columns: [
      {header: 'Project', dataIndex: 'project', flex: 1},
      {header: 'Purpose', dataIndex: 'purpose', flex: 1},
      {header: 'Status', dataIndex: 'status', flex: 1}
   ]
});

So in the console I see the values for project, purpose, status and additionalInfo but I get “undefined” for pointOfContacts.

Any suggestions?

UPDATE WITH FINAL WORKING CODE:
Here is the working code I used to retrieve the pointofContacts and load a grid on my form panel with the pointOfContacts

...
itemdblclick: function(dataview, record, item, e) {
    var comp = Ext.ComponentQuery.query('requestForm');
    comp[0].getForm().loadRecord(record);
    Ext.getCmp('pocGrid').reconfigure(record.pointOfContacts());
    var mainPanel = Ext.ComponentQuery.query('mainpanel');
    mainPanel[0].getLayout().setActiveItem('requestForm');
}
....
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T20:10:27+00:00Added an answer on June 15, 2026 at 8:10 pm

    Has many associations are not parsed in to associated records by default. Especially for the grid – as that is supposed to be a flat data view. Model docs show you how to setup associations but don’t say anything about creating instances for you 🙂
    There are links to usage of has many (http://docs.sencha.com/ext-js/4-1/#!/api/Ext.data.association.HasMany) from the Model docs. Unfortunately the usage is not what you expect it to be. Essentially it is designed to fetch the records on demand by calling their store to load.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This the model that I want to create using json file Ext.define('Users', { extend:
I am using EXT-JS 3.2.0 and I have an Ext.grid.EditorGridPanel backed by a Ext.data.Store
I'm building a search using ext-js. I have an event that fires on keyup.
I am using Ext.grid.EditorGridPanel to get some input from user. One of the columns
I am using Ext GWT. I have created a Grid with a CheckColumnConfig with
I'm using Ext.util.json.encode to encode the column model from a jqgrid, and passing that
I'm using Ext 4.1. I have some issues with loading json data with associations.
I am using Ext.Net 1.3 with ASP.NET 4.0 application. I have few Ext ComboBox
I am using Ext.js 4. I have a panel which contains log messages returned
How can I make an AJAX request using Ext JS and have the response

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.