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 8392327
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T19:29:23+00:00 2026-06-09T19:29:23+00:00

In EXTJS i will use a model and store for my grid. Now is

  • 0

In EXTJS i will use a model and store for my grid. Now is the problem that sometimes the json will not match the model. There will be less information then in my model. When this happens EXTJS will not show any data in the grid. So i looked for a fix and found this:

Ext.define('App.Reader', {
extend: 'Ext.data.reader.Json',

extractData: function(root) {
    var me = this,
        values  = [],
        records = [],
        Model   = me.model,
        i       = 0,
        length  = root.length,
        idProp  = me.getIdProperty(),
        node, id, record;

    if (!root.length && Ext.isObject(root)) {
        root = [root];
        length = 1;
    }

    for (; i < length; i++) {
        node   = root[i];
        values = me.extractValues(node);
        id     = me.getId(node);

        record = new Model(values, id, node);
        records.push(record);

        if (me.implicitIncludes) {
            me.readAssociated(record, node);
        }

    }

    return records;
},

extractValues: function(data) {
    var fields = this.getFields(),
        i      = 0,
        length = fields.length,
        output = {},
        field, value;

    for (; i < length; i++) {
        field = fields[i];
        value = this.extractorFunctions[i](data);

        if(value === undefined)
        {
            Ext.iterate(fields, function(key, val) {
                if (data[key] === undefined & i==val) {
                    console.log( "Model field <" + key.name + "> does not exist in data/node.");
                    value = "INVALID OR MISSING FIELD NAME";
                    var p = 0;
                    for(var prop in data) {
                        if(p==i){
                            if(data.hasOwnProperty(prop))console.log("Instead of <" + key.name + "> we have <" + prop + "> with value <" + data[prop]+ ">");
                        }
                        p++;
                    }
                }
            }, this);
        }

        output[field.name] = value;
    }

    return output;
}

});

var myReader = new App.Reader({
type:'json'
});

i found this online. But when i use this with EXTJS 4.1.1 there is an error in ext-all: TypeError: j is undefined.

Where should i look for the fix for this?

  • 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-09T19:29:25+00:00Added an answer on June 9, 2026 at 7:29 pm

    There’s no need to do something complicated to solve this trivial problem. Read up on Ext.data.Model and Ext.data.Field, configure your Model properly and you’re all set.

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

Sidebar

Related Questions

I have a problem. I use extjs grid . This grid will be refreshed
I am trying to use Ext.Ajax.request in ExtJS 4.02a but it will not run
Is there a function that can be called on an Ext.grid.Panel in ExtJS that
I am using extjs grid, and I have a jQuery timer, which will call
After several failed attempts using ExtJS I have now decided to use javascript.The requirement
I would like to open an Ext.Window in ExtJS , that will open an
When I define a model TeMdl and then use Fn TeMdl.load(1),it will send a
I want to use checkboxes in extjs to filter a grid. This is my
My extjs version is 4.0.2a. Sometimes vertical scrollbar in grid stops working. It is
I've opened up an ExtJs project that I've not had my head in for

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.