1. changed the layout & style for temporal graph vis.
2. Added latest version for datatable jquery plugin. 3. Changed pagination GUI for tmeporal graph vis.
This commit is contained in:
parent
ededec66ab
commit
a4686f0f77
6 changed files with 7219 additions and 26 deletions
|
@ -1,5 +1,187 @@
|
|||
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
|
||||
|
||||
|
||||
(function ($) {
|
||||
|
||||
$.fn.dataTableExt.oPagination.gmail_style = {
|
||||
|
||||
"fnInit": function ( oSettings, nPaging, fnCallbackDraw )
|
||||
{
|
||||
var nFirst = document.createElement( 'span' );
|
||||
var nPrevious = document.createElement( 'span' );
|
||||
var nInfo = document.createElement( 'div' );
|
||||
var nNext = document.createElement( 'span' );
|
||||
var nLast = document.createElement( 'span' );
|
||||
|
||||
/*
|
||||
nFirst.innerHTML = oSettings.oLanguage.oPaginate.sFirst;
|
||||
nPrevious.innerHTML = oSettings.oLanguage.oPaginate.sPrevious;
|
||||
nNext.innerHTML = oSettings.oLanguage.oPaginate.sNext;
|
||||
nLast.innerHTML = oSettings.oLanguage.oPaginate.sLast;
|
||||
*/
|
||||
|
||||
nFirst.innerHTML = "<span class='small-arrows'><<</span> First";
|
||||
nPrevious.innerHTML = "<span class='small-arrows'><</span> Prev";
|
||||
nNext.innerHTML = "Next <span class='small-arrows'>></span>";
|
||||
nLast.innerHTML = "Last <span class='small-arrows'>>></span>";
|
||||
|
||||
var oClasses = oSettings.oClasses;
|
||||
nFirst.className = oClasses.sPageButton+" "+oClasses.sPageFirst;
|
||||
nPrevious.className = oClasses.sPageButton+" "+oClasses.sPagePrevious;
|
||||
nNext.className= oClasses.sPageButton+" "+oClasses.sPageNext;
|
||||
nLast.className = oClasses.sPageButton+" "+oClasses.sPageLast;
|
||||
|
||||
nPaging.appendChild( nFirst );
|
||||
nPaging.appendChild( nPrevious );
|
||||
nPaging.appendChild( nInfo );
|
||||
nPaging.appendChild( nNext );
|
||||
nPaging.appendChild( nLast );
|
||||
|
||||
$(nFirst).click( function () {
|
||||
if ( oSettings.oApi._fnPageChange( oSettings, "first" ) )
|
||||
{
|
||||
fnCallbackDraw( oSettings );
|
||||
}
|
||||
} );
|
||||
|
||||
$(nPrevious).click( function() {
|
||||
if ( oSettings.oApi._fnPageChange( oSettings, "previous" ) )
|
||||
{
|
||||
fnCallbackDraw( oSettings );
|
||||
}
|
||||
} );
|
||||
|
||||
$(nNext).click( function() {
|
||||
if ( oSettings.oApi._fnPageChange( oSettings, "next" ) )
|
||||
{
|
||||
fnCallbackDraw( oSettings );
|
||||
}
|
||||
} );
|
||||
|
||||
$(nLast).click( function() {
|
||||
if ( oSettings.oApi._fnPageChange( oSettings, "last" ) )
|
||||
{
|
||||
fnCallbackDraw( oSettings );
|
||||
}
|
||||
} );
|
||||
|
||||
/* Take the brutal approach to cancelling text selection */
|
||||
$('span', nPaging)
|
||||
.bind( 'mousedown', function () { return false; } )
|
||||
.bind( 'selectstart', function () { return false; } );
|
||||
|
||||
/* ID the first elements only */
|
||||
if ( oSettings.sTableId !== '' && typeof oSettings.aanFeatures.p == "undefined" )
|
||||
{
|
||||
nPaging.setAttribute( 'id', oSettings.sTableId+'_paginate' );
|
||||
nFirst.setAttribute( 'id', oSettings.sTableId+'_first' );
|
||||
nPrevious.setAttribute( 'id', oSettings.sTableId+'_previous' );
|
||||
nInfo.setAttribute( 'id', 'infoContainer' );
|
||||
nNext.setAttribute( 'id', oSettings.sTableId+'_next' );
|
||||
nLast.setAttribute( 'id', oSettings.sTableId+'_last' );
|
||||
}
|
||||
},
|
||||
|
||||
/*
|
||||
* Function: oPagination.full_numbers.fnUpdate
|
||||
* Purpose: Update the list of page buttons shows
|
||||
* Returns: -
|
||||
* Inputs: object:oSettings - dataTables settings object
|
||||
* function:fnCallbackDraw - draw function to call on page change
|
||||
*/
|
||||
"fnUpdate": function ( oSettings, fnCallbackDraw )
|
||||
{
|
||||
if ( !oSettings.aanFeatures.p )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var iPageCount = 5;
|
||||
var iPageCountHalf = Math.floor(iPageCount / 2);
|
||||
var iPages = Math.ceil((oSettings.fnRecordsDisplay()) / oSettings._iDisplayLength);
|
||||
var iCurrentPage = Math.ceil(oSettings._iDisplayStart / oSettings._iDisplayLength) + 1;
|
||||
var iStartButton, iEndButton, i, iLen;
|
||||
var oClasses = oSettings.oClasses;
|
||||
|
||||
/* Pages calculation */
|
||||
if (iPages < iPageCount)
|
||||
{
|
||||
iStartButton = 1;
|
||||
iEndButton = iPages;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (iCurrentPage <= iPageCountHalf)
|
||||
{
|
||||
iStartButton = 1;
|
||||
iEndButton = iPageCount;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (iCurrentPage >= (iPages - iPageCountHalf))
|
||||
{
|
||||
iStartButton = iPages - iPageCount + 1;
|
||||
iEndButton = iPages;
|
||||
}
|
||||
else
|
||||
{
|
||||
iStartButton = iCurrentPage - Math.ceil(iPageCount / 2) + 1;
|
||||
iEndButton = iStartButton + iPageCount - 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Loop over each instance of the pager */
|
||||
var an = oSettings.aanFeatures.p;
|
||||
var anButtons, anStatic, nPaginateList;
|
||||
var fnClick = function() {
|
||||
/* Use the information in the element to jump to the required page */
|
||||
var iTarget = (this.innerHTML * 1) - 1;
|
||||
oSettings._iDisplayStart = iTarget * oSettings._iDisplayLength;
|
||||
fnCallbackDraw( oSettings );
|
||||
return false;
|
||||
};
|
||||
var fnFalse = function () { return false; };
|
||||
|
||||
for ( i=0, iLen=an.length ; i<iLen ; i++ )
|
||||
{
|
||||
if ( an[i].childNodes.length === 0 )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Update the 'premanent botton's classes */
|
||||
anButtons = an[i].getElementsByTagName('span');
|
||||
anStatic = [
|
||||
anButtons[0], anButtons[1],
|
||||
anButtons[anButtons.length-2], anButtons[anButtons.length-1]
|
||||
];
|
||||
$(anStatic).removeClass( oClasses.sPageButton+" "+oClasses.sPageButtonActive+" "+oClasses.sPageButtonStaticDisabled );
|
||||
if ( iCurrentPage == 1 )
|
||||
{
|
||||
anStatic[0].className += " "+oClasses.sPageButtonStaticDisabled;
|
||||
anStatic[1].className += " "+oClasses.sPageButtonStaticDisabled;
|
||||
}
|
||||
else
|
||||
{
|
||||
anStatic[0].className += " "+oClasses.sPageButton;
|
||||
anStatic[1].className += " "+oClasses.sPageButton;
|
||||
}
|
||||
|
||||
if ( iPages === 0 || iCurrentPage == iPages || oSettings._iDisplayLength == -1 )
|
||||
{
|
||||
anStatic[2].className += " "+oClasses.sPageButtonStaticDisabled;
|
||||
anStatic[3].className += " "+oClasses.sPageButtonStaticDisabled;
|
||||
}
|
||||
else
|
||||
{
|
||||
anStatic[2].className += " "+oClasses.sPageButton;
|
||||
anStatic[3].className += " "+oClasses.sPageButton;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
$.fn.ellipsis = function () {
|
||||
return this.each(function () {
|
||||
var el = $(this);
|
||||
|
@ -788,14 +970,19 @@ function prepareTableForDataTablePagination(jsonData){
|
|||
var searchBarParentContainerDIVClass = "searchbar";
|
||||
|
||||
var entityListTable = $('#datatable').dataTable({
|
||||
"sDom": '<"' + searchBarParentContainerDIVClass + '"f><"paginatedtabs"p><"datatablewrapper"t>',
|
||||
"sDom": '<"' + searchBarParentContainerDIVClass + '"f><"filterInfo"i><"paginatedtabs"p><"datatablewrapper"t>',
|
||||
"aaSorting": [
|
||||
[2, "desc"]
|
||||
],
|
||||
"asStripClasses": [],
|
||||
"iDisplayLength": 10,
|
||||
"sPaginationType": "full_numbers",
|
||||
// "aLengthMenu" : [5,10,15],
|
||||
"bInfo": true,
|
||||
"oLanguage": {
|
||||
"sInfo": "_START_ - _END_ of _TOTAL_",
|
||||
"sInfoEmpty": "No matching entities found",
|
||||
"sInfoFiltered": "",
|
||||
},
|
||||
"sPaginationType": "gmail_style",
|
||||
"fnDrawCallback": function () {
|
||||
|
||||
/* We check whether max number of allowed comparisions (currently 10) is reached
|
||||
|
@ -805,9 +992,6 @@ function prepareTableForDataTablePagination(jsonData){
|
|||
* */
|
||||
checkIfColorLimitIsReached();
|
||||
}
|
||||
|
||||
// "bLengthChange": false,
|
||||
// "bAutoWidth": false
|
||||
});
|
||||
|
||||
|
||||
|
@ -819,6 +1003,9 @@ function prepareTableForDataTablePagination(jsonData){
|
|||
entityListTable.fnFilter("");
|
||||
});
|
||||
|
||||
var filterInfo = $(".filterInfo").detach();
|
||||
$("#infoContainer").append(filterInfo);
|
||||
|
||||
}
|
||||
|
||||
function updateRowHighlighter(linkedCheckBox){
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue