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 | 1123x 1123x 11364x 11364x 11364x 200x 334x 334x 334x 534x 11250x 11250x 11250x 11250x 48x 11250x 11250x | /* global define */ define(['jquery', 'backbone', 'backgrid'], function ($, Backbone, Backgrid) { "use strict"; /** * Renders a checkbox for row selection. * * @export oro/datagrid/select-row-cell * @class oro.datagrid.SelectRowCell * @extends Backbone.View */ return Backbone.View.extend({ /** @property */ className: "AknGrid-bodyCell AknGrid-bodyCell--tight AknGrid-bodyCell--checkbox select-row-cell", /** @property */ tagName: "td", /** @property */ events: { "change :checkbox": "onChange", "click": "enterEditMode" }, /** * Initializer. If the underlying model triggers a `select` event, this cell * will change its checked value according to the event's `selected` value. * * @param {Object} options * @param {Backgrid.Column} options.column * @param {Backbone.Model} options.model */ initialize: function (options) { //Backgrid.requireOptions(options, ["model", "column"]); this.column = options.column; Iif (!(this.column instanceof Backgrid.Column)) { this.column = new Backgrid.Column(this.column); } this.listenTo(this.model, "backgrid:select", function (model, checked) { this.$el.find(":checkbox").prop("checked", checked).change(); }); }, /** * Focuses the checkbox. */ enterEditMode: function (e) { var $checkbox = this.$el.find(":checkbox").focus(); Iif ($checkbox[0] !== e.target) { $checkbox.prop("checked", !$checkbox.prop("checked")).change(); } e.stopPropagation(); }, /** * Unfocuses the checkbox. */ exitEditMode: function () { this.$el.find(":checkbox").blur(); }, /** * When the checkbox's value changes, this method will trigger a Backbone * `backgrid:selected` event with a reference of the model and the * checkbox's `checked` value. */ onChange: function (e) { this.model.trigger("backgrid:selected", this.model, $(e.target).prop("checked")); }, /** * Renders a checkbox in a table cell. */ render: function () { // work around with trigger event to get current state of model (selected or not) var state = {selected: false}; this.$el.empty().append('<input tabindex="-1" type="checkbox" />'); this.model.trigger('backgrid:isSelected', this.model, state); if (state.selected) { this.$el.find(':checkbox').prop('checked', 'checked'); } this.delegateEvents(); return this; } }); }); |