* code for task #2939.

This commit is contained in:
Catouse
2017-03-01 17:20:22 +08:00
parent 3e32f88360
commit fdd12316ae
15 changed files with 68 additions and 46 deletions
+29 -2
View File
@@ -91,10 +91,32 @@ function initTableHeader()
if(!$header.length)
{
$header = $('<div class="table-header-fixed" style="position: absolute; left: 0; top: 0; right: 0;"><table class="table table-fixed"></table></div>').css('right', $panel.width() - tableWidth).css('min-width', tableWidth);
$header.find('.table').addClass($table.attr('class')).append($table.find('thead').css('visibility', 'hidden').clone().css('visibility', 'visible'));
var $oldTableHead = $table.find('thead');
$oldTableHead.find('th').each(function(idx)
{
$(this).attr('data-idx', idx);
});
$header.find('.table').addClass($table.attr('class')).append($oldTableHead.css('visibility', 'hidden').clone().css('visibility', 'visible'));
$panel.addClass('with-fixed-header').append($header);
var $heading = $panel.children('.panel-heading');
if($heading.length) $header.css('top', $heading.outerHeight());
if($table.hasClass('tablesorter'))
{
$header.on('mousedown mouseup', 'th[data-idx]', function(e)
{
var $th = $(this);
var $targetTh = $oldTableHead.find('th[data-idx="' + $th.data('idx') + '"]').trigger(e);
if(e.type === 'mouseup')
{
var updateTh = function()
{
$header.find('thead').empty().append($oldTableHead.find('tr').clone());
};
setTimeout(updateTh, 10);
setTimeout(updateTh, 200);
}
});
}
}
else
{
@@ -152,7 +174,12 @@ $(function()
panelRemovingTip : config.confirmRemoveBlock,
resizable : !useGuest,
onResize : resizeBlock,
afterRefresh : initTableHeader
afterRefresh : function(e)
{
var $sortTable = e.$panel.find('.tablesorter');
if($sortTable.length) $sortTable.sortTable();
initTableHeader();
}
});
// $dashboard.find('ul.dashboard-actions').addClass('hide').children('li').addClass('right').appendTo($('#modulemenu > .nav'));
+1 -1
View File
@@ -10,7 +10,7 @@
* @link http://www.ranzhi.org
*/
?>
<table class='table table-data table-hover block-bug table-fixed'>
<table class='table table-data table-hover block-bug table-fixed tablesorter'>
<thead>
<tr>
<th width='50'><?php echo $lang->idAB?></th>
+1 -1
View File
@@ -10,7 +10,7 @@
* @link http://www.ranzhi.org
*/
?>
<table class='table table-data table-hover block-build table-fixed'>
<table class='table tablesorter table-data table-hover block-build table-fixed'>
<thead>
<tr>
<th width='50'><?php echo $lang->idAB?></th>
+1 -1
View File
@@ -10,7 +10,7 @@
* @link http://www.ranzhi.org
*/
?>
<table class='table table-data table-hover block-case table-fixed'>
<table class='table tablesorter table-data table-hover block-case table-fixed'>
<thead>
<tr>
<th width='50'><?php echo $lang->idAB?></th>
+1 -1
View File
@@ -16,6 +16,7 @@ $themeRoot = $webRoot . "theme/";
if(isset($pageCSS)) css::internal($pageCSS);
$useGuest = $this->app->user->account == 'guest';
?>
<?php include '../../common/view/tablesorter.html.php';?>
<div class='dashboard' id='dashboard' data-confirm-remove-block='<?php echo $lang->block->confirmRemoveBlock;?>'>
<div class='dashboard-actions'><a href='<?php echo $this->createLink("block", "admin", "id=0&module=$module"); ?>' data-toggle='modal' data-type='ajax' data-width='700' data-title='<?php echo $lang->block->createBlock?>'><i class='icon icon-plus' title='<?php echo $lang->block->createBlock?>' data-toggle='tooltip' data-placement='left'></i></a></div>
<div class='dashboard-empty-message hide'>
@@ -51,7 +52,6 @@ $useGuest = $this->app->user->account == 'guest';
</div>
<?php endforeach;?>
</div>
</div>
<script>
config.ordersSaved = '<?php echo $lang->block->ordersSaved; ?>';
+1 -1
View File
@@ -10,7 +10,7 @@
* @link http://www.ranzhi.org
*/
?>
<table class='table table-data table-hover block-plan table-fixed'>
<table class='table tablesorter table-data table-hover block-plan table-fixed'>
<thead>
<tr>
<th width='50'><?php echo $lang->idAB?></th>
+1 -1
View File
@@ -10,7 +10,7 @@
* @link http://www.zentao.net
*/
?>
<table class='table table-data table-hover table-fixed table-striped block-product'>
<table class='table tablesorter table-data table-hover table-fixed table-striped block-product'>
<thead>
<tr class='text-center'>
<th class='text-left'><?php echo $lang->product->name;?></th>
+3 -3
View File
@@ -14,17 +14,17 @@
<?php include '../../common/view/sparkline.html.php';?>
<?php $projectboxId = 'projectbox-' . rand(); ?>
<div id='<?php echo $projectboxId ?>'>
<table class='table table-data table-hover table-striped table-fixed block-project'>
<table class='table tablesorter table-data table-hover table-striped table-fixed block-project'>
<thead>
<tr class='text-center'>
<th><div class='text-left'><?php echo $lang->project->name;?></div></th>
<th class='text-left'><?php echo $lang->project->name;?></th>
<th width='80'><?php echo $lang->project->end;?></th>
<th width='50'><?php echo $lang->statusAB;?></th>
<th width='45'><?php echo $lang->project->totalEstimate;?></th>
<th width='45'><?php echo $lang->project->totalConsumed;?></th>
<th width='45'><?php echo $lang->project->totalLeft;?></th>
<th width='115'><?php echo $lang->project->progess;?></th>
<th width='100'><?php echo $lang->project->burn;?></th>
<th width='100' class='{sorter: false}'><?php echo $lang->project->burn;?></th>
</tr>
</thead>
<tbody>
+1 -1
View File
@@ -10,7 +10,7 @@
* @link http://www.ranzhi.org
*/
?>
<table class='table table-data table-hover block-release table-fixed'>
<table class='table tablesorter table-data table-hover block-release table-fixed'>
<thead>
<tr>
<th width='50'><?php echo $lang->idAB?></th>
+1 -1
View File
@@ -10,7 +10,7 @@
* @link http://www.ranzhi.org
*/
?>
<table class='table table-data table-hover block-story table-fixed'>
<table class='table tablesorter table-data table-hover block-story table-fixed'>
<thead>
<tr>
<th width='50'><?php echo $lang->idAB?></th>
+1 -1
View File
@@ -13,7 +13,7 @@
<style>
td.delayed{background: #e84e0f!important; color: white;}
</style>
<table class='table table-data table-hover block-task table-fixed'>
<table class='table tablesorter table-data table-hover block-task table-fixed'>
<thead>
<tr>
<th width='50'><?php echo $lang->idAB?></th>
+1 -1
View File
@@ -10,7 +10,7 @@
* @link http://www.ranzhi.org
*/
?>
<table class='table table-data table-hover block-testtask table-fixed'>
<table class='table tablesorter table-data table-hover block-testtask table-fixed'>
<thead>
<tr>
<th width='50'><?php echo $lang->idAB?></th>
+1 -1
View File
@@ -10,7 +10,7 @@
* @link http://www.ranzhi.org
*/
?>
<table class='table table-data table-hover block-todo table-fixed'>
<table class='table tablesorter table-data table-hover block-todo table-fixed'>
<thead>
<tr>
<th width='90'><?php echo $lang->todo->date?></th>
+22 -27
View File
@@ -9,38 +9,33 @@ table.tablesorter tr.tablesorter-headerRow .header.headerSortUp .tablesorter-hea
table.tablesorter tr.tablesorter-headerRow .header.headerSortDown .tablesorter-header-inner:after{font-family: NewZenIcon; font-weight: normal; content: "\e6b8"; font-size: 14px; color: #03C;}
table.tablesorter tr.tablesorter-headerRow .header.sorter-false .tablesorter-header-inner:after{content:"";}
</style>
<script language='javascript'>
/* sort table after page load. */
$(function(){sortTable('.tablesorter');});
function sortTable(obj)
<script>
function sortTable(selector, options)
{
if(typeof(obj) == 'undefined') obj = '.tablesorter';
$(obj).tablesorter(
var $table = $(selector);
$table.tablesorter($.extend(
{
saveSort: true,
widgets: ['zebra', 'saveSort'],
widgetZebra: {css: ['odd', 'even'] }
}, $table.data(), options)).on('mouseenter', 'tbody tr', function()
{
$(this).addClass('hoover');
}).on('mouseleave', 'tbody tr', function()
{
$(this).removeClass('hoover');
}).on('click', 'tbody tr', function()
{
$(this).toggleClass('clicked');
});
$(obj + ' tbody tr').hover(
function(){$(this).addClass('hoover')},
function(){$(this).removeClass('hoover')}
);
$(obj + ' tbody tr').click(
function()
{
if($(this).attr('class').indexOf('clicked') > 0)
{
$(this).removeClass('clicked');
}
else
{
$(this).addClass('clicked');
}
}
);
}
$.fn.sortTable = function(options)
{
return this.each(function()
{
sortTable(this, options);
});
};
/* sort table after page load. */
$(function(){$('.tablesorter').sortTable();});
</script>
+3 -3
View File
File diff suppressed because one or more lines are too long