Results 1 to 3 of 3

Thread: how to deal the store for a Grid.

  1. #1
    Sencha User
    Join Date
    Dec 2012
    Vote Rating

    Default how to deal the store for a Grid.

    hi All,

    I am new to ext4.x, and currently I use the MVC structure of extjs ,and I used the associations in the model, then the issue is how to retrieve the associations data by using store?

    Ext.define('CAS.reportingAdmin.model.Report', {

    fields: [
    'reportName', 'enabled', 'executable', 'description', 'configured',
    'clientMetadata', 'displayGroupCode',
    'inconsistentWithSourceSystem', 'reportId',
    associations: [
    type: 'hasMany',
    model: 'CAS.reportingAdmin.model.ReportParameter',
    name: 'reportParameters',
    instanceName: 'reportParameter'

    proxy: Ext.create('CAS.reportingAdminTest.proxies.ReportFileAjaxProxy')

    Ext.define('', {
    extend: '',
    requires: 'CAS.reportingAdmin.model.Report',
    autoLoad: true,
    autoSync: true,

    constructor: function (cfg) {
    cfg = cfg || {};
    return this.callParent([

    model: "CAS.reportingAdmin.model.Report",
    proxy: this.reportsProxy,
    listeners: {
    'load': function (store, records, options) {'Start reportStore loaded');'End reportStore loaded');
    }, cfg)]);

    then VIEW:
    Ext.define('CAS.reportingAdmin.view.parameter.ReportParameter', {
    extend : 'Ext.grid.Panel',
    alias : 'widget.reportparameter',
    title : 'Parameter List',

    initComponent : function() {
    store : 'Reports', columns : [{
    text : "Name",
    flex : 1,
    dataIndex :'name',
    groupable : false

    }, {
    text : "Hidden",
    flex : 1,
    dataIndex : 'required',
    groupable : false

    }, {
    text : "Enabled",
    flex : 1,
    dataIndex : 'reportParameter.',
    groupable : false


    so in the view level , I can get the report store correctly, but that's not I want to display , actually I only want to display the reportParameter (which is the association part of report), so I need to parse the retrieved store and only get the parameter content of the store data and then display to the page, so how to this action?

    thanks in advance.

  2. #2
    Sencha - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Gainesville, FL
    Vote Rating


    Sounds like you aren't wanting to use associations. You could use mapping config in the field of the model to grab nested data and make it available to the top level record.
    Mitchell Simoens @LikelyMitch
    Sencha Inc, Senior Software Engineer
    Learn BBCode and use it!

    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2

    Think my support is good? Get more personalized support via a support subscription.

    Need more help with your app? Hire Sencha Services

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  3. #3
    Sencha User
    Join Date
    Dec 2012
    Vote Rating


    thanks, you r correct, if don't want to use association, mapping config in the model can be a good a good approach.

    and here is my current solution, maybe help for new comer:
    in this situation , we can parse store

    var index = this.getStore().findExact('name',paraName);
    var record= this.getStore().getAt(index);

    and many ways to parse store, and this is just one of them.


Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts