extjsrenderergridpanel

How to 'get' another Model field on ExtJS 5.1.1


I'm trying to use renderer config inside Ext.column. I have two fields states in Model; balanceok and lastbalance. But it gives this error:

[W] XTemplate evaluation exception: getRecord is not defined

How I can display another field with get method?

Model:

Ext.define('MultiDB.model.FolioModel', {
    extend: 'Ext.data.Model',
    fields: [
        {name: 'clientname', type: 'string'},
        {name: 'balanceok', type: 'bool'},
        {name: 'lastbalance', type: 'int'}
    ]

Grid Panel:

{
  dataIndex: 'balanceok',
  flex: 1,
  text: 'Balance',
  renderer: function (value, record, store) {
     if (value == 1) {
        return "All Paid";
     } else {
        return getRecord('lastbalance');
     }
  }
}

Solution

  • Not sure where you found getRecord, the correct call would be:

    record.get('lastbalance');
    

    As a side note, the check for value == 1 is a little odd since the field will be casted to a boolean because of the model.