X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=webapp%2Fresources%2Fdatatables-1.9.4%2Fexamples%2Fadvanced_init%2Ffooter_callback.html;fp=webapp%2Fresources%2Fdatatables-1.9.4%2Fexamples%2Fadvanced_init%2Ffooter_callback.html;h=5a617019407296db4a6ea40fec62d21989239bd8;hb=9bb6ee99ca7f738fac1087190b5481b8fe6e8d9f;hp=0000000000000000000000000000000000000000;hpb=2e3f6b76be585306f1003d849831840c0adb3360;p=proteocache.git diff --git a/webapp/resources/datatables-1.9.4/examples/advanced_init/footer_callback.html b/webapp/resources/datatables-1.9.4/examples/advanced_init/footer_callback.html new file mode 100644 index 0000000..5a61701 --- /dev/null +++ b/webapp/resources/datatables-1.9.4/examples/advanced_init/footer_callback.html @@ -0,0 +1,650 @@ + + + + + + + DataTables example + + + + + + +
+
+ DataTables footer callback example +
+ +

Preamble

+

DataTables using the header and footer callback manipulation functions (fnHeaderCallback() and fnFooterCallback()) you can perform some powerful and useful data manipulation. The example given below shows how a callback function can be used to total up visible (and hidden) data, taking into account all of DataTable's features (pagination, filtering etc).

+ +

Live example

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Rendering engineBrowserEngine versionCSS gradeMarket share (%)
Trident + Internet + Explorer + 4.0 + 4X0.01
TridentInternet + Explorer 5.05C0.1
TridentInternet + Explorer 5.55.5A0.5
TridentInternet + Explorer 66A36
TridentInternet Explorer 77A41
TridentAOL browser (AOL desktop)6A1
GeckoFirefox 1.01.7A0.1
GeckoFirefox 1.51.8A0.5
GeckoFirefox 2.01.8A7
GeckoFirefox 3.01.9A9
GeckoCamino 1.01.8A0.01
GeckoCamino 1.51.8A0.01
GeckoNetscape 7.21.7A0.01
GeckoNetscape Browser 81.7A0.01
GeckoNetscape Navigator 91.8A0.01
GeckoMozilla 1.01A0.01
GeckoMozilla 1.11.1A0.01
GeckoMozilla 1.21.2A0.01
GeckoMozilla 1.31.3A0.01
GeckoMozilla 1.41.4A0.01
GeckoMozilla 1.51.5A0.01
GeckoMozilla 1.61.6A0.01
GeckoMozilla 1.71.7A0.01
GeckoMozilla 1.81.8A0.01
GeckoSeamonkey 1.11.8A0.01
GeckoEpiphany 2.201.8A0.01
WebkitSafari 1.2125.5A0.01
WebkitSafari 1.3312.8A0.01
WebkitSafari 2.0419.3A1
WebkitSafari 3.0522.1A2.2
WebkitOmniWeb 5.5420A0.01
WebkitiPod Touch / iPhone420.1A0.05
WebkitS60413A0.01
PrestoOpera 7.0-A0.01
PrestoOpera 7.5-A0.01
PrestoOpera 8.0-A0.01
PrestoOpera 8.5-A0.01
PrestoOpera 9.0-A0.1
PrestoOpera 9.2-A0.2
PrestoOpera 9.5-A0.8
PrestoOpera for Wii-A0.01
PrestoNokia N800-A0.01
PrestoNintendo DS browser8.5C/A10.01
KHTMLKonqureror 3.13.1C0.01
KHTMLKonqureror 3.33.3A0.01
KHTMLKonqureror 3.53.5A0.01
TasmanInternet Explorer 4.5-X0.01
TasmanInternet Explorer 5.11C0.01
TasmanInternet Explorer 5.21C0.01
MiscNetFront 3.1-C0.01
MiscNetFront 3.4-A0.01
MiscDillo 0.8-X0.01
MiscLinks-X0.01
MiscLynx-X0.01
MiscIE Mobile-C0.01
MiscPSP browser-C0.01
Other browsersAll others-U0.04
Total:
+
+
+ +

Warning! The market share information given in this table is fabricated using a combination of (mild) judgement, the BBC Browser Statistics information and statistics from TheCounter.com. THe lowest usage given to anyone browser is 0.01 for reasons of this example.

+ + +

Initialisation code

+
$(document).ready(function() {
+	$('#example').dataTable( {
+		"fnFooterCallback": function ( nRow, aaData, iStart, iEnd, aiDisplay ) {
+			/*
+			 * Calculate the total market share for all browsers in this table (ie inc. outside
+			 * the pagination)
+			 */
+			var iTotalMarket = 0;
+			for ( var i=0 ; i<aaData.length ; i++ )
+			{
+				iTotalMarket += aaData[i][4]*1;
+			}
+			
+			/* Calculate the market share for browsers on this page */
+			var iPageMarket = 0;
+			for ( var i=iStart ; i<iEnd ; i++ )
+			{
+				iPageMarket += aaData[ aiDisplay[i] ][4]*1;
+			}
+			
+			/* Modify the footer row to match what we want */
+			var nCells = nRow.getElementsByTagName('th');
+			nCells[1].innerHTML = parseInt(iPageMarket * 100)/100 +
+				'% ('+ parseInt(iTotalMarket * 100)/100 +'% total)';
+		}
+	} );
+} );
+ + + + +

Other examples

+ + + + + + +
+ + \ No newline at end of file