Position address on the devices grid

Victor Ferreira6 years ago

I'm trying to show the device position on the device grid (not just in the state panel) but I wasn't successful. I decide to copy the status column because it shows informations coming from a different Store, but somehow it's not working. What am I doing wrong? Is there any way to show the address in the devices grid?

In my testing the renderer callback is getting the right value as parameter, but the method getById doesn't work at all.

Here's the code I used to show the address:

{
            text: 'Address',
            dataIndex: 'positionId',
            filter: {
                type: 'list',
                labelField: 'address',
                store: 'Positions'
            },
            renderer: function (value) {
                var status;
                if (value) {
                    status = Ext.getStore('Positions').getById(value);
                    if (status) {
                        return status.get('address');
                    }
                }
                return null;
            }
}
Victor Ferreira6 years ago

I also tried this code below and could get right value for the address, but could not figure out which object I should set the attribute. What is the array that contains the data that populates the devices grid?

var store = Ext.getStore('Positions').load({
                            params: {
                                id: value
                            },
                            scope: this,
                            callback: function (records, operation, success) {
                                if (success) {
                                    console.log(records[0].data);
                                }
                            }
                        });
JLS GPS4 years ago

Did you ever figure this out? This would be a great feature to show the current address next to the device.