We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 34017
    • 898 Posts
    Perl,

    You might want to check out http://rikrikrik.com/jquery/pager/. It is a jquery plugin that basically lets tabs look like pagination for individual divs (sections).

    Also, here is some code I used to create a non-editable, yet sortable, table in JQuery:

    Template (in <head>)
    	<style type="text/css">@import "[(base_url)]assets/js/default.css";</style>
    	<script type="text/javascript" src="[(base_url)]assets/js/jquery.js"></script>
    	<script type="text/javascript" src="[(base_url)]assets/js/jquery.tablesorter.js"></script>
    
    	<script>
    	$(function() {
    		$("#styling-custom-highlighting").tableSorter({
    			sortColumn: '1',					// Integer or String of the name of the column to sort by.
    			sortClassAsc: 'headerSortUp',		// Class name for ascending sorting action to header
    			sortClassDesc: 'headerSortDown',	// Class name for descending sorting action to header
    			highlightClass: 'highlight', 		// class name for sort column highlighting.
    			stripingRowClass: ['even','odd'],	// Class names for striping supplyed as a array.
    			headerClass: 'header'				// Class name for headers (th's)
    		});
    	});
    	</script>
    


    MODx Document

    [[show_table]] <!-- Call Snippet -->
    
    <table id="styling-custom-highlighting" border="0" cellpadding="0" cellspacing="0">
    <thead>
    	<tr>
    		<th>Header 1</th>
    		<th>Header 2</th>
    		<th>etc.</th>
    	</tr>
    </thead>
    
    [+show_table_results+] <!-- Call placeholder -->
    
    </tbody>
    </table>
    


    Snippet - named [[show_table]]
    $ds = $modx->db->select('*', 'CHOOSE YOUR TABLE', '"', '', '');
    		
    		if ($modx->db->getRecordCount($ds) > 0) {
    
    				while($row = $modx->db->getRow($ds)) {
    						$key = '';
    						$value = '';
    
    						$chunk_tpl = 'show_table_row'; // name of chunk
    						$chunkTpl = $modx->getChunk($chunk_tpl);
    
    							foreach($row as $key => $value) {
    								$chunkTpl = str_replace('[+' . $key . '+]', $value, $chunkTpl);
    							}	
    					
    						$createList .= 	$chunkTpl;
    				}
    				
    				$placeholder_tpl = 'show_table_results'; // name of placeholder
    				$modx->setPlaceHolder($placeholder_tpl, $createList);
    		
    		} else {
    			echo "No results found.";
    		}
    


    Chunk - named {{show_table_row}}
    (replace table_column1 with the names of your database columns
    <tr>
    	<td>[+table_column1+]</td>
    	<td>[+table_column2+]</td>
    	<td>[+etc+]</td>
    </tr>
    


    This code is almost completely from a function in Uncle’s ppp snippet. The Jscript is from http://motherrussia.polyester.se/jquery-plugins/tablesorter/

    Hope it can be of use to you.

    Chuck
      Chuck the Trukk
      ProWebscape.com :: Nashville-WebDesign.com
      - - - - - - - -
      What are TV's? Here's some info below.
      http://modxcms.com/forums/index.php/topic,21081.msg159009.html#msg1590091
      http://modxcms.com/forums/index.php/topic,14957.msg97008.html#msg97008
      • 26016
      • 561 Posts
      Chuck,
      Thanks, man! I’ll have to try to delve into that. With all the javascript it’ll go really easy on the server... very nice!

      Good work!
        MODx and Wordpress development
        Linux, PHP 5.2, MySQL 5.0, Evo 1.05, Revo 2.08-pl, Firefox 4