Add new "v3" grids, refactor all views to use them
or at least that's the idea..hopefully we caught them all
This commit is contained in:
parent
f244c2934b
commit
5b1ae27a10
71 changed files with 2679 additions and 2030 deletions
tailbone/static/js
68
tailbone/static/js/jquery.ui.tailbone.js
vendored
68
tailbone/static/js/jquery.ui.tailbone.js
vendored
|
@ -117,17 +117,31 @@
|
|||
});
|
||||
|
||||
// Refresh data when user clicks a sortable column header.
|
||||
this.element.on('click', 'thead th.sortable a', function() {
|
||||
var th = $(this).parent();
|
||||
var data = {
|
||||
sortkey: th.data('sortkey'),
|
||||
sortdir: (th.hasClass('sorted') && th.hasClass('asc')) ? 'desc' : 'asc',
|
||||
page: 1,
|
||||
partial: true
|
||||
};
|
||||
that.refresh(data);
|
||||
return false;
|
||||
});
|
||||
if (this.grid.hasClass('grid3')) {
|
||||
this.element.on('click', 'tr.header a', function() {
|
||||
var td = $(this).parent();
|
||||
var data = {
|
||||
sortkey: $(this).data('sortkey'),
|
||||
sortdir: (td.hasClass('asc')) ? 'desc' : 'asc',
|
||||
page: 1,
|
||||
partial: true
|
||||
};
|
||||
that.refresh(data);
|
||||
return false;
|
||||
});
|
||||
} else {
|
||||
this.element.on('click', 'thead th.sortable a', function() {
|
||||
var th = $(this).parent();
|
||||
var data = {
|
||||
sortkey: th.data('sortkey'),
|
||||
sortdir: (th.hasClass('sorted') && th.hasClass('asc')) ? 'desc' : 'asc',
|
||||
page: 1,
|
||||
partial: true
|
||||
};
|
||||
that.refresh(data);
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
// Refresh data when user chooses a new page size setting.
|
||||
this.element.on('change', '.pager #pagesize', function() {
|
||||
|
@ -145,15 +159,39 @@
|
|||
});
|
||||
|
||||
// Add hover highlight effect to grid rows during mouse-over.
|
||||
this.element.on('mouseenter', 'tbody tr', function() {
|
||||
this.element.on('mouseenter', 'tbody tr:not(.header)', function() {
|
||||
$(this).addClass('hovering');
|
||||
});
|
||||
this.element.on('mouseleave', 'tbody tr', function() {
|
||||
this.element.on('mouseleave', 'tbody tr:not(.header)', function() {
|
||||
$(this).removeClass('hovering');
|
||||
});
|
||||
|
||||
// Do some extra stuff for grids with checkboxes.
|
||||
if (this.grid.hasClass('selectable')) {
|
||||
// do some extra stuff for grids with checkboxes
|
||||
if (this.grid.hasClass('grid3')) {
|
||||
|
||||
// (un-)check all rows when clicking check-all box in header
|
||||
if (this.grid.find('tr.header td.checkbox input').length) {
|
||||
this.element.on('click', 'tr.header td.checkbox input', function() {
|
||||
var checked = $(this).prop('checked');
|
||||
that.grid.find('tr:not(.header) 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', '.newgrid tr:not(.header) td.checkbox input', function(event) {
|
||||
event.stopPropagation();
|
||||
});
|
||||
this.element.on('click', '.newgrid tr:not(.header) a', function(event) {
|
||||
event.stopPropagation();
|
||||
});
|
||||
this.element.on('click', '.newgrid tr:not(.header)', function() {
|
||||
$(this).find('td.checkbox input').click();
|
||||
});
|
||||
|
||||
} else if (this.grid.hasClass('selectable')) { // pre-v3 newgrid.selectable
|
||||
|
||||
// (Un-)Check all rows when clicking check-all box in header.
|
||||
this.element.on('click', 'thead th.checkbox input', function() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue