I'm just wondering how do I the following:

1) do calculations on JSON data fields before outputting them in the grid? for example, if I have Spend and Revenue fields in the example below, how do I fill the ROI field in the grid with Revenue/Spend calculation?

2) how can I wrap links around some of these entries? for example, again, below, how can I get "a href=..." wrapped around PubName with some of the variables from the JSON feed itself, so have something like <a href="PubId">PubName</a> output instead of just PubName in the grid?


var data = <?php echo $json; ?>;
   Ext.define('Placements', {
       extend: 'Ext.data.Model',
       fields: [
      {name: 'PubId',    type: 'int'},
      {name: 'PubName',    type: 'string'},

      {name: 'Imp',       type: 'int'},
      {name: 'Spend',        type: 'double'},
      {name: 'Revenue',    type: 'double'},
    var store = Ext.create('Ext.data.Store', {
         autoLoad: true,
         data : data,
         model: 'Placements',
         proxy: {
          type: 'memory',
          reader: {
          type: 'json',
          //record: 'data_type'
    Ext.create('Ext.Panel', {
         id: 'junk',
         renderTo: 'grid-table',
         width: 1024,
         layout: 'vbox',
         items: [
            xtype: 'grid',
            title: 'Placements',
            width: 1024,
            height: 800,
            store: store,
            viewConfig: { emptyText: 'No data' },
            columns: [
             { header: 'Placement',   dataIndex: 'PubName'},
             { header: 'Impressions',    dataIndex: 'Imp'},
             { header: 'Spend',        dataIndex: 'Spend'},
             { header: 'Revenue',     dataIndex: 'Revenue'},
             { header: 'ROI',      dataIndex: ''},