3

I have a model called 'Students' where one of the fields 'Team' is defined as:

{
  name: 'team',
  type: 'int',
  useNull: true
}

Now I want to group on this field using:

Ext.getStore('Students').group('team');

And it's throwing this error "Uncaught TypeError: Cannot call method 'get' of null".

I tested if the absence of nulls fixes the issue by filling the nulls in with empty strings and the error went away.

How can I fix this so I'm able to group nulls into their own group? Without throwing the error?

Cain
  • 181
  • 1
  • 1
  • 7

1 Answers1

1

You can set convert setting to team field in model.

{
  name: 'team',
  type: 'int',
  useNull: true,
  convert: function(value) {
    return: value ? value : 0;
  }
}

then you can use int zero instead of null.

Shantha Kumara
  • 3,272
  • 4
  • 40
  • 52
Dmitry Manannikov
  • 1,124
  • 1
  • 10
  • 14