All files / web/bundles/pimdatagrid/js/datagrid/column action-column.js

100% Statements 10/10
70% Branches 7/10
100% Functions 2/2
100% Lines 10/10

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46  1123x                     1123x                                     1245x 1245x 1245x   1245x 1245x   1245x 178x   1245x        
/* global define */
define(['underscore', 'backgrid', 'oro/datagrid/action-cell'],
function(_, Backgrid, ActionCell) {
    'use strict';
 
    /**
     * Column of grid that contains row actions
     *
     * @export  oro/datagrid/action-column
     * @class   oro.datagrid.ActionColumn
     * @extends Backgrid.Column
     */
    return Backgrid.Column.extend({
 
        /** @property {Object} */
        defaults: _.extend({}, Backgrid.Column.prototype.defaults, {
            name: 'rowActions',
            label: '',
            editable: false,
            cell: ActionCell,
            headerCell: Backgrid.HeaderCell.extend({
                className: 'AknGrid-headerCell action-column'
            }),
            sortable: false,
            actions: []
        }),
 
        /**
         * {@inheritDoc}
         */
        initialize: function (attrs) {
            attrs = attrs || {};
            Eif (!attrs.cell) {
                attrs.cell = this.defaults.cell;
            }
            Eif (!attrs.name) {
                attrs.name = this.defaults.name;
            }
            if (!attrs.actions || _.isEmpty(attrs.actions)) {
                this.set('renderable', false);
            }
            Backgrid.Column.prototype.initialize.apply(this, arguments);
        }
    });
});