Click here to Skip to main content
15,892,161 members
Home / Discussions / JavaScript
   

JavaScript

 
AnswerRe: Enable pop up blocker using Javascript Pin
twseitex11-Dec-11 7:23
twseitex11-Dec-11 7:23 
AnswerRe: Enable pop up blocker using Javascript Pin
AprNgp26-Dec-11 17:26
AprNgp26-Dec-11 17:26 
QuestionTransforming a table to node diagram Pin
info_hacker8-Dec-11 21:12
info_hacker8-Dec-11 21:12 
QuestionUsing Javascript to list local directory contents Pin
Member 84548754-Dec-11 8:15
Member 84548754-Dec-11 8:15 
AnswerRe: Using Javascript to list local directory contents Pin
Wonde Tadesse5-Dec-11 4:36
professionalWonde Tadesse5-Dec-11 4:36 
QuestionJavascript code to fetch data from an excel file and upload data to an ftp site Pin
zone132-Dec-11 11:15
zone132-Dec-11 11:15 
AnswerRe: Javascript code to fetch data from an excel file and upload data to an ftp site Pin
twseitex3-Dec-11 5:59
twseitex3-Dec-11 5:59 
QuestionDrag & Drop jQuery to table rows and update database? Pin
btvbill30-Nov-11 10:28
btvbill30-Nov-11 10:28 
I've spent days looking for a way to use jQuery drag & drop with table rows but have only been able to find ways to save/update the database for list items, not rows. The other issue I have is that my page only has one row and pulls from a database with a repeat region loop that creates new rows so I have no way to create id's for each new row. If anyone can help me out with a script that would update my database after a jQuery drag & drop, I'd really appreciate it. Here's an example of my code that works except for the updates:

<pre lang="PHP">

<?php require_once('Connections/dragdrop.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  $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;
}
}

$maxRows_rsView = 10;
$pageNum_rsView = 0;
if (isset($_GET['pageNum_rsView'])) {
  $pageNum_rsView = $_GET['pageNum_rsView'];
}
$startRow_rsView = $pageNum_rsView * $maxRows_rsView;

mysql_select_db($database_dragdrop, $dragdrop);
$query_rsView = "SELECT * FROM records";
$query_limit_rsView = sprintf("%s LIMIT %d, %d", $query_rsView, $startRow_rsView, $maxRows_rsView);
$rsView = mysql_query($query_limit_rsView, $dragdrop) or die(mysql_error());
$row_rsView = mysql_fetch_assoc($rsView);

if (isset($_GET['totalRows_rsView'])) {
  $totalRows_rsView = $_GET['totalRows_rsView'];
} else {
  $all_rsView = mysql_query($query_rsView);
  $totalRows_rsView = mysql_num_rows($all_rsView);
}
$totalPages_rsView = ceil($totalRows_rsView/$maxRows_rsView)-1;
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script type='text/javascript' src="jquery-1.7.1.min.js"></script>
<script src="jquery.tablednd_0_5.js" type="text/javascript"></script>
<!-- Add in the jQuery draggability -->
<script type="text/javascript">
$(document).ready(function() {
    // Initialise the table
    $("#table-1").tableDnD();
});
</script>

</head>

<body>
<table id="table-1" width="600" border="1" cellpadding="5">
  <tr>
    <td>ID</td>
    <td>Rank</td>
    <td>Text</td>
    <td>Listing ID</td>
  </tr>
  <?php do { ?>
    <tr id="1">
      <td><?php echo $row_rsView['recordID']; ?></td>
      <td><?php echo $row_rsView['Rank']; ?></td>
      <td><?php echo $row_rsView['recordText']; ?></td>
      <td><?php echo $row_rsView['recordListingID']; ?></td>
    </tr>
    <?php } while ($row_rsView = mysql_fetch_assoc($rsView)); ?>
</table>

</body>
</html>
<?php
mysql_free_result($rsView);
?>

AnswerRe: Drag & Drop jQuery to table rows and update database? Pin
Dennis E White1-Dec-11 7:14
professionalDennis E White1-Dec-11 7:14 
QuestionJavascript / JQuery pop-up message question Pin
AeonBlue30-Nov-11 4:59
AeonBlue30-Nov-11 4:59 
AnswerRe: Javascript / JQuery pop-up message question Pin
Not Active30-Nov-11 6:05
mentorNot Active30-Nov-11 6:05 
AnswerRe: Javascript / JQuery pop-up message question Pin
Dennis E White30-Nov-11 7:29
professionalDennis E White30-Nov-11 7:29 
GeneralRe: Javascript / JQuery pop-up message question Pin
AeonBlue30-Nov-11 8:52
AeonBlue30-Nov-11 8:52 
GeneralRe: Javascript / JQuery pop-up message question Pin
Dennis E White30-Nov-11 11:13
professionalDennis E White30-Nov-11 11:13 
QuestionConfirm dialog with OK ,CANCEL buttons on window close Pin
siva45524-Nov-11 20:20
siva45524-Nov-11 20:20 
AnswerRe: Confirm dialog with OK ,CANCEL buttons on window close Pin
phome25-Nov-11 23:08
phome25-Nov-11 23:08 
GeneralRe: Confirm dialog with OK ,CANCEL buttons on window close Pin
Shameel26-Dec-11 4:02
professionalShameel26-Dec-11 4:02 
Questionenable check box not working Pin
byka22-Nov-11 9:20
byka22-Nov-11 9:20 
AnswerRe: enable check box not working Pin
Richard MacCutchan22-Nov-11 9:30
mveRichard MacCutchan22-Nov-11 9:30 
GeneralRe: enable check box not working Pin
byka22-Nov-11 9:35
byka22-Nov-11 9:35 
GeneralRe: enable check box not working Pin
Richard MacCutchan22-Nov-11 9:54
mveRichard MacCutchan22-Nov-11 9:54 
QuestionRe: enable check box not working Pin
DaveAuld22-Nov-11 9:46
professionalDaveAuld22-Nov-11 9:46 
AnswerRe: enable check box not working Pin
byka22-Nov-11 9:49
byka22-Nov-11 9:49 
AnswerRe: enable check box not working Pin
Satheesh154622-Nov-11 16:47
Satheesh154622-Nov-11 16:47 
GeneralRe: enable check box not working Pin
byka23-Nov-11 2:15
byka23-Nov-11 2:15 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.