  /**
   * committeeListing/index.js
   *
   * Describes a single political committee.
   **/

   (function() {
    'use strict';

    angular
    .module('committeeListing',[])
    .directive('committeeListing', committeeListingDirective);

    function committeeListingDirective() {
      return {
        restrict: 'E',
        template: require('./committeeListing.html'),
        controller: committeeListingController,
        controllerAs: '$ctrl',
        bindToController: true,
        scope: {
          committee: '=',
          contributions: '=',
        }
      };
    }

    committeeListingController.$inject = ['$filter'];
    function committeeListingController($filter) {
      var contributionsObjs,
          gridWidth;

      var ctrl = this;
      ctrl.committeeTotal = 0;
      ctrl.contributionsSearch = '';

      // ag-grid requires fixed widths in pixels. Calculating them here to take all available space
      var odcaGridElement = document.querySelectorAll('.odca-grid')[0];
      gridWidth = odcaGridElement.offsetWidth;

      // Convert resources to plain old objects to make ag-grid happy
      contributionsObjs = ctrl.contributions.map(function(resource) {
        // Total listed contributions
        ctrl.committeeTotal += resource.Tran_Amt1;

        return {
          Name: getFriendlyName(resource),
          Tran_Amt1: resource.Tran_Amt1,
          Tran_Date: resource.Tran_Date
        };
      });

      ctrl.gridOptions = {
        columnDefs: [
          {
            headerName: 'Contributor',
            field: 'Name',
            filter: 'text',
            width: Math.round(gridWidth * 0.6 * 100) / 100,
            suppressMenu: true
          },
          {
            headerName: 'Amount',
            field: 'Tran_Amt1',
            width: Math.round(gridWidth * 0.2 * 100) / 100,
            cellFormatter: function(params) {
              return $filter('currency')(params.value, '$', 0);
            },
            sort: 'desc',
            suppressMenu: true
          },
          {
            headerName: 'Date',
            field: 'Tran_Date',
            width: Math.round(gridWidth * 0.2 * 100) / 100,
            suppressMenu: true
          }
        ],
        headerHeight: 40,
        enableSorting: true,
        enableFilter: true,
        rowData: contributionsObjs,
        rowHeight: 40,
        suppressMovableColumns: true
      };

      // Combine first and last name, capitalize
      function getFriendlyName(resource) {
        var names = [];
        if (resource.Tran_NamF) {
          names = names.concat(resource.Tran_NamF.split(' '));
        }
        
        if (resource.Tran_NamL) {
          names = names.concat(resource.Tran_NamL.split(' '));
        }
        
        return names.join(' ');
      }

    }



})();

@@ -390,17 +390,17 @@
 roller: 
-c
+C
 ommittee
@@ -580,25 +580,25 @@
 %0A    %7D%0A%0A    
-c
+C
 ommitteeList
@@ -639,33 +639,33 @@
 %5D;%0A    function 
-c
+C
 ommitteeListingC
@@ -700,71 +700,57 @@
 ar c
-ontributionsObjs,%0A          gridWidth;%0A%0A      var ctrl = thi
+trl = this;%0A      %0A      var contributionsObj
 s;%0A
+%0A
     
@@ -818,228 +818,8 @@
 ';%0A%0A
-      // ag-grid requires fixed widths in pixels. Calculating them here to take all available space%0A      var odcaGridElement = document.querySelectorAll('.odca-grid')%5B0%5D;%0A      gridWidth = odcaGridElement.offsetWidth;%0A%0A
     
@@ -1378,54 +1378,66 @@
     
-w
+minW
 idth: 
-Math.round(gridWidth * 0.6 * 100) / 100
+300,%0A            width: getColumnWidth(0.6, 300)
 ,%0A  
@@ -1572,54 +1572,66 @@
     
-w
+minW
 idth: 
-Math.round(grid
+100,%0A            width: getColumn
 Width
- * 0.2 *
+(0.2,
  100)
- / 100
 ,%0A  
@@ -1915,54 +1915,66 @@
     
-w
+minW
 idth: 
-Math.round(grid
+110,%0A            width: getColumn
 Width
- * 0.2 * 10
+(0.2, 11
 0)
- / 100
 ,%0A  
@@ -2598,24 +2598,539 @@
 ');%0A      %7D%0A
+      %0A      // ag-grid requires fixed widths in pixels. Calculating them here to take all available space%0A      function getColumnWidth(percentOfWidth, minWidth) %7B%0A        var allocatedWidth, gridWidth, minWidth, odcaGridElement;%0A        %0A        odcaGridElement = document.querySelectorAll('.odca-grid')%5B0%5D;%0A        gridWidth = odcaGridElement.offsetWidth;%0A        allocatedWidth = Math.round(gridWidth * percentOfWidth * 100) / 100;%0A%0A        return allocatedWidth %3E= minWidth ? allocatedWidth : minWidth;%0A      %7D
 %0A    %7D%0A%0A%0A%0A%7D)
@@ -3126,15 +3126,14 @@
     %7D%0A%0A%0A
-%0A
 %7D)();%0A

Set minimum widths for ag-grid columns