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 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 | 1123x 1123x 1245x 1245x 1133x 1245x 1052x 1245x 1245x 1077x 1077x 1077x 2322x 11364x 11364x 64x 2322x 2322x 1946x 2322x | /* global define */
define(['underscore', 'backgrid', 'oro/datagrid/row'],
function(_, Backgrid, Row) {
'use strict';
/**
* Grid body widget
*
* Triggers events:
* - "rowClicked" when row of body is clicked
*
* @export oro/datagrid/body
* @class oro.datagrid.Body
* @extends Backgrid.Body
*/
return Backgrid.Body.extend({
/** @property */
row: Row,
/** @property {String} */
rowClassName: undefined,
/**
* @inheritDoc
*/
initialize: function(options) {
options = options || {};
if (!options.row) {
options.row = this.row;
}
if (options.rowClassName) {
this.rowClassName = options.rowClassName;
}
Backgrid.Body.prototype.initialize.apply(this, arguments);
this._listenToRowsEvents(this.rows);
},
/**
* @inheritDoc
*/
refresh: function() {
Backgrid.Body.prototype.refresh.apply(this, arguments);
this._listenToRowsEvents(this.rows);
return this;
},
/**
* @inheritDoc
*/
insertRow: function(model, collection, options) {
Backgrid.Body.prototype.insertRow.apply(this, arguments);
var index = collection.indexOf(model);
if (index < this.rows.length) {
this._listenToOneRowEvents(this.rows[index]);
}
},
/**
* Listen to events of rows list
*
* @param {Array} rows
* @private
*/
_listenToRowsEvents: function(rows) {
_.each(rows, function(row) {
this._listenToOneRowEvents(row);
}, this);
},
/**
* Listen to events of row
*
* @param {Backgrid.Row} row
* @private
*/
_listenToOneRowEvents: function(row) {
this.listenTo(row, 'clicked', function(row, e) {
this.trigger('rowClicked', row, e);
});
},
/**
* @inheritDoc
*/
render: function() {
Backgrid.Body.prototype.render.apply(this, arguments);
if (this.rowClassName) {
this.$('> *').addClass(this.rowClassName);
}
return this;
}
});
});
|