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

  • SEARCH
  • Home
  • 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 7947799
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T01:32:11+00:00 2026-06-04T01:32:11+00:00

With ExtJS 3.x, I was able to use the fields property of a Store,

  • 0

With ExtJS 3.x, I was able to use the “fields” property of a Store, but it seems with ExtJS 4 I have to absolutely use a Model. It’s fine, but in my case, it’s not a static Model, and I need to define the fields on the fly and sometimes to change them.

I could re-create a Model, but I need to use a different name as it’s apparently not possible to modify an exisiting Model, neither delete it. If I try to use Ext.regModel with the same name, ExtJS crashes.

Thanks for your help!

  • 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-04T01:32:13+00:00Added an answer on June 4, 2026 at 1:32 am

    4.1 UPDATE:

    As an update… in 4.1 there is now a static method setFields which can be used to define the model prototype fields. It works well in a controller’s init method.

    When I did this, I wanted to have some static fields defined in the model class and then set some more dynamically. Unfortunately the new setFields method replaces all fields with the argument, it was easy enough to handle though.

    This example uses the MVC pattern where my model and store are included in the controller’s model array and store array (providing me with the handy getters used below):

    Ext.define('ST.controller.Main', {
        extend: 'Ext.app.Controller',
    
        models: ['User', 'Reference'],
    
        stores: ['CurrentUser', 'PermissionRef'],
    
        views: ['MainPanel'],
    
        init: function() {
            var me = this;
    
            me.getPermissionRefStore().on('load', function(store, records) {
                var model = me.getUserModel();
                    // this returns the static fields already defined 
                    // in my User model class
                    fields = model.prototype.fields.getRange();
    
                // add the permission options (dynamic fields) to the static fields
                Ext.each(records, function(permission) {
                    fields.push({name: permission.get('name'), type: 'bool'});
                });
    
                // 4.1 method to update the User model fields
                model.setFields(fields);
    
                // now load the current user (it will use the updated model)
                me.getCurrentUserStore().load();
    
            });
    
        }
    
    });
    

    The User model and CurrentUser store are created exactly like regular, non-dynamic models and stores would be and included in their respective controller arrays, the ‘User’ model is simply missing the dynamic fields which are added as shown above.

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

Sidebar

Related Questions

ExtJS Class Handling is good to handle, but you have to pay it with
In ExtJs3 I was able to use the fieldsets config property forceLayout . To
I am trying to use extjs store to talk to a Jersey rest Java
I'm developing a GXT application, and I've noticed that I'm not able to use
Sencha Ext JS Calendar looks suitable for my application, but could not able to
I'm not too familiar with ExtJS, but am working on a project that uses
I was looking for something like 'load' listener of store in Extjs 4, but
I am using ExtJS 4.1.0 Say I have a couple simple model's connected via
I am using ExtJS 4. I have created a tree panel as var treeStore
I use ExtJs 4.1 and DeftJs. When using multiple instances of the same views

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.