custom ViewList

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Abanoub
    Junior Member
    • Sep 2016
    • 23

    custom ViewList

    I have added custom viewlist to opportunity

    PHP Code:
      Espo.define('custom:views/deal/list', ['views/list', 'lib!DataTable','lib!DataTableBootstrap'], function (Dep) {      return Dep.extend({         template: "custom:deal/list",          setup: function () {             Dep.prototype.setup.call(this);           },          afterRender: function () {             Dep.prototype.setup.call(this);               $('#example').DataTable({                 "dom": '<"toolbar">frtip'             });          },          data: function () {             var data = Dep.prototype.data.call(this);              return data;         }     });  }); 
    
    PHP Code:
      <link type="text/css" rel="stylesheet" href="{{basePath}}client/custom/css/dataTables.bootstrap.min.css">  <div class="container">     <div class="row">         <div id="toolbar" class="dropdown">             <button class="btn btn-default dropdown-toggle" type="button" id="dropdownMenu1" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">                 Dropdown                 <span class="caret"></span>             </button>             <ul class="dropdown-menu" aria-labelledby="dropdownMenu1">              </ul>         </div>     </div>     <div class="row">         <table id="example" class="table table-striped table-bordered" cellspacing="0" width="100%">             <thead>             <tr>                 <th>Deal name</th>                 <th>Deal stage</th>                 <th>Close Date</th>                 <th>Owner</th>                 <th>Amount</th>                 <th>Associated with</th>             </tr>             </thead>             <tfoot>             <tr>                 <th>Deal name</th>                 <th>Deal stage</th>                 <th>Close Date</th>                 <th>Owner</th>                 <th>Amount</th>                 <th>Associated with</th>             </tr>             </tfoot>             <tbody>              </tbody>         </table>     </div> </div> 
    
    and I have commented the old controller and added this new one
    PHP Code:
      <?php   namespace Espo\Custom\Controllers;  class Opportunity extends \Espo\Core\Templates\Controllers\Base {     public function actionList($params, $data, $request)     {         $res = parent::actionList($params, $data, $request);          //$a = $this->getEntityManager()->getEntity('stage');         die(var_dump($res));         return $res;     } }
    and in I have added scope for it , to make it custom:

    PHP Code:
      {     "entity": true,     "layouts": true,     "tab": true,     "acl": true,     "aclPortal": true,     "customizable": true,     "importable": true,     "notifications": true,     "stream": false,     "disabled": false,     "type": "Base",     "module": "Custom",     "object": true,     "isCustom": false } 
    
    now when I try to load it, it throws this error

    PHP Code:
    VM18163:23 Uncaught TypeError: Cannot read property 'call' of nulldata @ VM18163:23_getData @ espo.min.js?r=1473761755286:16(anonymous function) @ espo.min.js?r=1473761755286:16tryReady @ espo.min.js?r=1473761755286:16(anonymous function) @ espo.min.js?r=1473761755286:16(anonymous function) @ espo.min.js?r=1473761755286:16(anonymous function) @ espo.min.js?r=1473761755286:16(anonymous function) @ espo.min.js?r=1473761755286:16_executeLoadCallback @ espo.min.js?r=1473761755286:16(anonymous function) @ espo.min.js?r=1473761755286:16j @ espo.min.js?r=1473761755286:3fireWith @ espo.min.js?r=1473761755286:3x @ espo.min.js?r=1473761755286:4(anonymous function) @ espo.min.js?r=1473761755286:4 
    
    what am I doing wrong here?
Working...