Add basic checkbox support to new grids.

Also:

 * Add 'creatable', 'editable' etc. to master view class.
 * Add styles for warning/notice grid rows.
 * Misc. other tweaks.
This commit is contained in:
Lance Edgar 2015-08-14 15:30:38 -05:00
parent e79531fda8
commit d2b065a8fc
13 changed files with 229 additions and 71 deletions

View file

@ -115,6 +115,29 @@
$(this).removeClass('hovering');
});
// Do some extra stuff for grids with checkboxes.
if (this.grid.hasClass('selectable')) {
// (Un-)Check all rows when clicking check-all box in header.
this.element.on('click', 'thead th.checkbox input', function() {
var checked = $(this).prop('checked');
that.grid.find('tbody td.checkbox input').prop('checked', checked);
});
// Select current row when clicked, unless clicking checkbox
// (since that already does select the row) or a link (since
// that does something completely different).
this.element.on('click', 'tbody td.checkbox input', function(event) {
event.stopPropagation();
});
this.element.on('click', 'tbody a', function(event) {
event.stopPropagation();
});
this.element.on('click', 'tbody tr', function() {
$(this).find('td.checkbox input').click();
});
}
// Show 'more' actions when user hovers over 'more' link.
this.element.on('mouseenter', '.actions a.more', function() {
that.grid.find('.actions div.more').hide();