WebContent/js/explore/spaces.js
/**
 * Handles querying for pages in a given DataTable object
 *
 * @param sSource the "sAjaxSource" of the calling table
 * @param aoData the parameters of the DataTable object to send to the server
 * @param fnCallback the function that actually maps the returned page to the DataTable object
 * @author Todd Elvers
 */
Handles querying for pages in a given DataTable object

@param sSource the "sAjaxSource" of the calling table
@param aoData the parameters of the DataTable object to send to the server
@param fnCallback the function that actually maps the returned page to the DataTable object
@author Todd Elvers
Handles querying for pages in a given DataTable object @param sSource the " sAjaxSource " of the calling table @param aoData the parameters of the DataTable object to send to the server @param fnCallback the function that actually maps the returned page to the DataTable object @author Todd Elvers
function fnPaginationHandler(sSource, aoData, fnCallback) {
	var tableName = $(this).attr('id');
	var idOfSelectedSpace = $('#exploreList')
	.find('.jstree-clicked')
	.parent()
	.attr("id");
	if (idOfSelectedSpace == null || typeof idOfSelectedSpace == 'undefined') {
		idOfSelectedSpace = $.cookie("jstree_select");
		if (idOfSelectedSpace == null || typeof idOfSelectedSpace == 'undefined') {
			$('#exploreList').jstree('select_node', '#1', true);
			idOfSelectedSpace = 1;
		} else {
			idOfSelectedSpace = idOfSelectedSpace[1];
		}
	}
	if (sortOverride != null && tableName == "benchmarks") {
		aoData.push({"name": "sort_by", "value": getSelectedSort()});
		aoData.push({"name": "sort_dir", "value": isASC()});
	}
	log('Source: ' + sSource + idOfSelectedSpace + "/" + tableName + "/pagination");
	$.ajax({
		type: 'POST',
		url: sSource + idOfSelectedSpace + "/" + tableName + "/pagination",
		data: aoData,
		dataType: "json"
	}).done(function(nextDataTablePage) {
		var s = parseReturnCode(nextDataTablePage, false);
		if (s) {
			fnCallback(nextDataTablePage);
			if ('j' == tableName[0]) {
				colorizeJobStatistics();
			}
			initDraggable('#' + tableName);
		}
	}).always(function() {
		if (spaceId != 1 && typeof spaceId != 'undefined' && 'j' == tableName[0]) {
			setTimeout(function() {
				var rows = $(jobTable)
				.children('tbody')
				.children('tr.row_selected');
				if (rows.length == 0) {
					jobTable.fnDraw(false);
				}
			}, 10000);
		}
	});
}
function fnPaginationHandler ( sSource , aoData , fnCallback ) { var tableName = $ ( this ) . attr ( 'id' ) ; var idOfSelectedSpace = $ ( '#exploreList' ) . find ( '.jstree-clicked' ) . parent ( ) . attr ( "id" ) ; if ( idOfSelectedSpace == null || typeof idOfSelectedSpace == 'undefined' ) { idOfSelectedSpace = $ . cookie ( "jstree_select" ) ; if ( idOfSelectedSpace == null || typeof idOfSelectedSpace == 'undefined' ) { $ ( '#exploreList' ) . jstree ( 'select_node' , '#1' , true ) ; idOfSelectedSpace = 1 ; } else { idOfSelectedSpace = idOfSelectedSpace [ 1 ] ; } } if ( sortOverride != null && tableName == "benchmarks" ) { aoData . push ( { "name" : "sort_by" , "value" : getSelectedSort ( ) } ) ; aoData . push ( { "name" : "sort_dir" , "value" : isASC ( ) } ) ; } log ( 'Source: ' + sSource + idOfSelectedSpace + "/" + tableName + "/pagination" ) ; $ . ajax ( { type : 'POST' , url : sSource + idOfSelectedSpace + "/" + tableName + "/pagination" , data : aoData , dataType : "json" } ) . done ( function ( nextDataTablePage ) { var s = parseReturnCode ( nextDataTablePage , false ) ; if ( s ) { fnCallback ( nextDataTablePage ) ; if ( 'j' == tableName [ 0 ] ) { colorizeJobStatistics ( ) ; } initDraggable ( '#' + tableName ) ; } } ) . always ( function ( ) { if ( spaceId != 1 && typeof spaceId != 'undefined' && 'j' == tableName [ 0 ] ) { setTimeout ( function ( ) { var rows = $ ( jobTable ) . children ( 'tbody' ) . children ( 'tr.row_selected' ) ; if ( rows . length == 0 ) { jobTable . fnDraw ( false ) ; } } , 10000 ) ; } } ) ; }
Handles querying for pages in a given DataTable object
Handles querying for pages in a given DataTable object
// Extract the id of the currently selected space from the DOM
 // If we can't find the id of the space selected from the DOM, get it from the cookie instead
 // If we also can't find the cookie, then just set the space selected to be the root space
 // Request the next page of primitives from the server via AJAX
 // Replace the current page with the newly received page
 // If the primitive type is 'job', then color code the results appropriately
 // Make the table that was just populated draggable too
 // Reload the jobs table 10 seconds after receiving the response.
 //log('Setting new call to happen in 10 seconds.');
