Current location: Hot Scripts Forums » General Web Coding » JavaScript » hide/show columns


hide/show columns

Reply
  #1 (permalink)  
Old 09-25-09, 04:59 AM
vuksy vuksy is offline
New Member
 
Join Date: Sep 2009
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
hide/show columns

hi

i'm a biology student and very new to coding

i'm trying to make a website that will categorize and index documentaries (from usenet and p2p)non profit project

managed to make a table like this one frequency decoder ~ table sort (revisited) demo in dreamweaver

and now i'm trying to make checkboxes that will hide/show the columns , but it's hard cause it's a dynamic table plus i'm using the script from above

could someone help me with this ?
Reply With Quote
  #2 (permalink)  
Old 09-25-09, 06:24 AM
wirehopper's Avatar
wirehopper wirehopper is offline
-
 
Join Date: Feb 2006
Posts: 2,515
Thanks: 20
Thanked 109 Times in 106 Posts
Please post your code.
Reply With Quote
  #3 (permalink)  
Old 09-25-09, 06:40 AM
vuksy vuksy is offline
New Member
 
Join Date: Sep 2009
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
well this is the code
HTML Code:
<?php require_once('Connections/connection.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  if (PHP_VERSION < 6) {
    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  }

  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}
mysql_select_db($database_connection, $connection);
$query_Recordset1 = "SELECT Title, Category, Series, Episode, `Year`, Resolution, `Video Bitrate`, `Video Codec` FROM documentaries";
$Recordset1 = mysql_query($query_Recordset1, $connection) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
?>
<html>
	<head>
    
    <script type="text/javascript" src="tablesort.<acronym title="JavaScript">js</acronym>"></script>
<script type="text/javascript">function hideShow("Title", "checkboxTitle"){
    if(document.getElementById("checkboxTitle").checked == true){ show("Title");}
    else{ hide("Title");}
    }

    function hide("Title"){
    document.getElementById("Recordset1").hideColumn(parseInt("Title"));
    document.getElementById("Recordset1").refreshView();
    };
    function show("Title"){
    document.getElementById("Recordset1").showColumn(parseInt("Title"));
    document.getElementById("Recordset1").refreshView();
    }; 
    var table = document.getElementByID("Recordset1");

table.rows[index]


    
    </script>
	<title>Main Table</title>
    
    <link href="StyleSheets.css" rel="stylesheet" type="text/css">
	</head>

	<body>
    <?php include("includes/header.php"); ?>
      <div align="center"><br>
        <span class="tip"></br>
        <br></br>
        Hold down shift to sort by multiple columns </span><br></br>
        <script fdTableSort.jsWrapper("Recordset1"); ></script>
      </div>
      <input type="checkbox" name="checkboxTitle" id="checkboxTitle" onclick ="hideShow('Title', 'checkboxTitle')">
      <table id="Recordset1" name="Recordset1">
        <tr>
          <th class="sortable" >Title</th>
          <th class="sortable" >Category</th>
          <th class="sortable" >Series</th>
          <th class="sortable" >Episode</th>
          <th class="sortable" >Year</th>
          <th class="sortable" >Resolution</th>
          <th class="sortable" >Video Bitrate</th>
          <th class="sortable" >Video Codec</th>
       </tr>
        <?php do { ?>
          <tr > 
            <td><?php echo $row_Recordset1['Title']; ?></td>
            <td><?php echo $row_Recordset1['Category']; ?></td>
            <td><?php echo $row_Recordset1['Series']; ?></td>
            <td><?php echo $row_Recordset1['Episode']; ?></td>
            <td><?php echo $row_Recordset1['Year']; ?></td>
            <td><?php echo $row_Recordset1['Resolution']; ?></td>
            <td><?php echo $row_Recordset1['Video Bitrate']; ?></td>
            <td><?php echo $row_Recordset1['Video Codec']; ?></td>
          </tr>
          <?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?>
      </table>
<?php include("includes/footer.php"); ?>
</body>
     
</html>
<?php
mysql_free_result($Recordset1);
?>
and i've atached all my site files cause others have tried to help me with this but said they cant unless they have all the files

i hope you can look at these files with a virtual server , cause i think you'll need the php for this as well
Attached Files
File Type: zip docu.zip (50.8 KB, 6 views)

Last edited by vuksy; 09-25-09 at 06:50 AM.
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Create dynamic rows and columns in html using data from MYSQL table paligron PHP 5 09-17-11 01:47 AM
colour selected columns using php sessions? benq PHP 12 05-10-06 10:14 AM
How to Display Data in Columns php-learner PHP 3 02-17-06 03:45 AM
printing columns using TAB function MonsterMagnet Windows .NET Programming 0 06-04-04 07:00 PM
Print MySQL resultset to five columns HTML-table morrowind PHP 1 05-03-04 08:13 AM


All times are GMT -5. The time now is 01:55 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.