mirror of
https://github.com/opensourcepos/opensourcepos.git
synced 2026-05-24 16:28:40 -04:00
Mark totals row as static (keep it at bottom of the table issue #131)
This commit is contained in:
@@ -54,7 +54,7 @@ function get_sales_manage_table_data_rows($sales, $controller)
|
||||
}
|
||||
else
|
||||
{
|
||||
$table_data_rows .= "<tr><td> </td><td>".$CI->lang->line('sales_total')."</td><td> </td><td> </td><td>".to_currency($sum_amount_tendered)."</td><td>".to_currency($sum_amount_due)."</td><td>".to_currency($sum_change_due)."</td><td colspan=\"3\"></td></tr>";
|
||||
$table_data_rows .= "<tr class='static'><td> </td><td>".$CI->lang->line('sales_total')."</td><td> </td><td> </td><td>".to_currency($sum_amount_tendered)."</td><td>".to_currency($sum_amount_due)."</td><td>".to_currency($sum_change_due)."</td><td colspan=\"3\"></td></tr>";
|
||||
}
|
||||
|
||||
return $table_data_rows;
|
||||
|
||||
@@ -18,7 +18,8 @@
|
||||
<script type="text/javascript" src="js/jquery.form-3.51.js" language="javascript"></script>
|
||||
<script type="text/javascript" src="js/jquery.jkey-1.1.js" language="javascript"></script>
|
||||
<script type="text/javascript" src="js/jquery.metadata.js" language="javascript"></script>
|
||||
<script type="text/javascript" src="js/jquery.tablesorter.min.js" language="javascript"></script>
|
||||
<script type="text/javascript" src="js/jquery.tablesorter-2.20.1.js" language="javascript"></script>
|
||||
<script type="text/javascript" src="js/jquery.tablesorter.staticrow.js" language="javascript"></script>
|
||||
<script type="text/javascript" src="js/jquery.validate-1.13.1-min.js" language="javascript"></script>
|
||||
<script type="text/javascript" src="js/common.js" language="javascript"></script>
|
||||
<script type="text/javascript" src="js/date.js" language="javascript"></script>
|
||||
|
||||
@@ -154,7 +154,8 @@ function init_table_sorting()
|
||||
7: { sorter: 'false'},
|
||||
8: { sorter: 'invoice_number'},
|
||||
9: { sorter: 'false'}
|
||||
}
|
||||
},
|
||||
widgets: ['staticRow']
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
2121
dist/opensourcepos.js
vendored
2121
dist/opensourcepos.js
vendored
File diff suppressed because one or more lines are too long
9
dist/opensourcepos.min.js
vendored
9
dist/opensourcepos.min.js
vendored
File diff suppressed because one or more lines are too long
2042
js/jquery.tablesorter-2.20.1.js
Normal file
2042
js/jquery.tablesorter-2.20.1.js
Normal file
File diff suppressed because it is too large
Load Diff
3
js/jquery.tablesorter.min.js
vendored
3
js/jquery.tablesorter.min.js
vendored
File diff suppressed because one or more lines are too long
76
js/jquery.tablesorter.staticrow.js
Normal file
76
js/jquery.tablesorter.staticrow.js
Normal file
@@ -0,0 +1,76 @@
|
||||
/*
|
||||
*
|
||||
* StaticRow widget for jQuery TableSorter 2.0
|
||||
* Version 1.0
|
||||
*
|
||||
* Copyright (c) 2011 Nils Luxton
|
||||
* Licensed under the MIT license:
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
*
|
||||
*/
|
||||
|
||||
$.tablesorter.addWidget({
|
||||
|
||||
// Give the new Widget an ID to be used in the tablesorter() call, as follows:
|
||||
// $('#myElement').tablesorter({ widgets: ['zebra','staticRow'] });
|
||||
id: 'staticRow',
|
||||
|
||||
// "Format" is run on all widgets once when the tablesorter has finished initialising,
|
||||
// and then again every time a sort has finished.
|
||||
format: function(table) {
|
||||
|
||||
// Use a property of the function to determine
|
||||
// whether this is the first run of "Format"
|
||||
// (i.e. is this the table's default starting position,
|
||||
// or has it been sorted?)
|
||||
if (typeof $(table).data('hasSorted') == 'undefined')
|
||||
{
|
||||
$(table).data('hasSorted', true); // This will force us into the "else" block the next time "Format" is run
|
||||
|
||||
// "Index" the static rows, saving their current (starting)
|
||||
// position in the table inside a data() param on the
|
||||
// <tr> element itself for later use.
|
||||
$('tbody .static', table).each(function() {
|
||||
$(this).data('tableindex', $(this).index());
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
// Loop the static rows, moving them to their
|
||||
// original "indexed" position, and keep doing
|
||||
// this until no more re-shuffling needs doing
|
||||
var hasShuffled = true;
|
||||
|
||||
while (hasShuffled)
|
||||
{
|
||||
hasShuffled = false;
|
||||
$('tbody .static', table).each(function() {
|
||||
var targetIndex = $(this).data('tableindex');
|
||||
if (targetIndex != $(this).index())
|
||||
{
|
||||
hasShuffled = true;
|
||||
var thisRow = $(this).detach();
|
||||
var numRows = $('tbody tr', table).length;
|
||||
|
||||
// Are we trying to be the last row?
|
||||
if (targetIndex >= numRows)
|
||||
{
|
||||
thisRow.appendTo($('tbody', table));
|
||||
}
|
||||
// Are we trying to be the first row?
|
||||
else if (targetIndex == 0)
|
||||
{
|
||||
thisRow.prependTo($('tbody', table));
|
||||
}
|
||||
// No, we want to be somewhere in the middle!
|
||||
else
|
||||
{
|
||||
thisRow.insertBefore($('tbody tr:eq(' + targetIndex + ')', table));
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user