Unable to read the 'fields' property of null


I've been working with Extjs for about two weeks now and I've been bombarded by several errors (since I'm new to this framework ) and today checking my console , since I have a problem with a combobox, of an item that is selected until clicking on it twice and not once (as it should).

The error notice reads as follows:


Uncaught TypeError: Can not read property 'fields' of null'

Which, checking my code, is in the next block (note that I will trace the area where exactly it tells me that the possible error would be):

classifyFields: function (field, list) {
        var me = this;
        var type = null;
// el siguiente if, en teoría, es el problema.
        if (field.fields.variableLengthField) {
            type = "variableLenghtField";
        } else if (field.fields.journalSaved) {
            type = "journalField";
        console.log(type, field, list);
        list.forEach(function (item) {
            if (item.name == type) {
                    "uuidFielMonitorType": item.uuid,
                    "fieldProperties": field.fields

Can someone guide me with this? I say, to know if this is really the problem that originates me about the bug with the Combobox , it is necessary to thank them for the help!

asked by Diego 28.03.2016 в 18:34

2 answers


Uncaught TypeError: Can not read property 'fields' of null'

You can not read the property "fields" because field has a Null value , check that it has a value to be able to access its properties:

  if (field.fields.variableLengthField) {
answered by 28.03.2016 в 20:33

Check that the fields attribute of your function is different from null , for example to prevent the function from continuing if that parameter is null you can execute the following before using it:

if (!fields) {

This way the function ends if that parameter has not been sent.

answered by 29.03.2016 в 00:39