473,698 Members | 2,588 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Drag and drop help needed: drag column data upwards and downwards

1 New Member
HIii...

Its me sujith
i've done something with AJAX.

but for the rest i need someo ones help..

i've done half the work.

there are two tables. "ajax1" and "ajax2" (check db.sql)

db.sql
Expand|Select|Wrap|Line Numbers
  1. CREATE TABLE `ajax2` (
  2.   `id` int(11) NOT NULL auto_increment,
  3.   `id_ajax1` int(11) NOT NULL,
  4.   PRIMARY KEY  (`id`)
  5. );
  6.  
  7. INSERT INTO `ajax2` VALUES (145, 4);
  8.  
  9. CREATE TABLE `ajax1` (
  10.   `id` int(11) NOT NULL auto_increment,
  11.   `name` varchar(20) NOT NULL,
  12.   PRIMARY KEY  (`id`)
  13. );
  14.  
  15. INSERT INTO `ajax1` VALUES (1, 'Habeeb');
  16. INSERT INTO `ajax1` VALUES (2, 'Sujith');
  17. INSERT INTO `ajax1` VALUES (3, 'Jeevan');
  18. INSERT INTO `ajax1` VALUES (4, 'Aditi');
  19. INSERT INTO `ajax1` VALUES (5, 'Ramu');
  20. INSERT INTO `ajax1` VALUES (6, 'Raghavan');
  21.  
ad.html

[HTML]<html>
<head>
<script type="text/javascript">
var url = "testajax.php?a id=";
var url_remove = "testajax.php?a ct=rem&aid=";

function handleHttpRespo nse() {
if (http.readyStat e == 4) {
if(http.status= =200) {
var results=http.re sponseText;
document.getEle mentById('divre sult').innerHTM L = results;
}
}
}

function request_table_a jax2_add(aid) {
http.open("GET" , url+aid, true);
http.onreadysta techange = handleHttpRespo nse;
http.send(null) ;
}

function request_table_a jax2_remove(aid ) {
http.open("GET" , url_remove+aid, true);
http.onreadysta techange = handleHttpRespo nse;
http.send(null) ;
}

function getHTTPObject() {
var xmlhttp;
if(window.XMLHt tpRequest){
xmlhttp = new XMLHttpRequest( );
}
else if (window.ActiveX Object){
xmlhttp=new ActiveXObject(" Microsoft.XMLHT TP");
if (!xmlhttp){
xmlhttp=new ActiveXObject(" Msxml2.XMLHTTP" );
}
}
return xmlhttp;
}

function request_table_a jax2_1() {
http.open("GET" , url, true);
http.onreadysta techange = handleHttpRespo nse;
http.send(null) ;
}

var http = getHTTPObject() ;
</script>
</head>
<body>
<div id="divresult"> </div>
<script type="text/javascript">
request_table_a jax2_1();
</script>
</body>
</html>
[/HTML]


testajax.php

[PHP]<?php
mysql_connect(" localhost", "username", "");
//mysql_connect(" localhost", "username", "");
mysql_select_db ("test") or die(mysql_error ());
//mysql_select_db ("db_ajax_habi" ) or die(mysql_error ());

if(strlen(trim( $_GET['aid']))>0) {
if($_GET['act']=='rem') {
$rem_query=mysq l_query("DELETE FROM ajax2 WHERE id_ajax1=$_GET[aid]");
} else {
$get_query=mysq l_query("SELECT * FROM ajax1 WHERE id=\"$_GET[aid]\"") or die(mysql_error ());
if(mysql_num_ro ws($get_query) > 0) {
$add_query=mysq l_query("INSERT ajax2(id_ajax1) VALUES(\"$_GET[aid]\")");
}
}

}
?>
<table border="0" width="70%"><tr ><td width="35%" valign="top">
<?php
$query=mysql_qu ery("SELECT * FROM ajax1") or die(mysql_error ());
$row = mysql_num_rows( $query);
for($i = 0; $i < $row; $i++){
$name = mysql_result($q uery,$i,'name') ;
$id = mysql_result($q uery,$i,'id');
$query_ajax2=my sql_query("SELE CT * FROM ajax2 WHERE id_ajax1=$id");
if(mysql_num_ro ws($query_ajax2 ) > 0 ) {
echo "<img name='aid' id='aid' src=\"images/icon2.gif\" onClick=\"reque st_table_ajax2_ remove($id);\"> &nbsp;<font face='verdana' size='2'><b>$na me</font><br>";
} else {
echo "<img name='aid' id='aid' src=\"images/icon1.gif\" onClick=\"reque st_table_ajax2_ add($id);\">&nb sp;<font face='verdana' size='2'><b>$na me</font><br>";
}

}
?>
</td><td width="35%" valign="top">
<?php
$query1=mysql_q uery("SELECT * FROM ajax2") or die(mysql_error ());

if(mysql_num_ro ws($query1)>0){
for($i=0;$i<mys ql_num_rows($qu ery1);$i++){
$id=mysql_resul t($query1, $i, 'id_ajax1');
$query2=mysql_q uery("SELECT name FROM ajax1 WHERE id=$id") or die(mysql_error ());

if(mysql_num_ro ws($query2)>0){
for($j=0;$j<mys ql_num_rows($qu ery2);$j++){
$name1 = mysql_result($q uery2,$j,'name' );
echo "<font face='verdana' size='2' color='red'><b> $name1</b></font><br />";
}
}
}
}
?>
</td></tr></table>
[/PHP]
Now i can do the clicking process.

im able to add data to table "ajax2" from table "ajax1" by clickin on the "add" button.
deletion also possible.

But now my problem is drag and drop.

i need to drag data in the second column (ie; the result of clicked items) upwards and downwards..
but im not able to do it..
can u plz halp me to do that??

run it on Mozilla firefox..
then u will understand my problem..

plz help me..
Nov 29 '06 #1
1 1643
acoder
16,027 Recognized Expert Moderator MVP
This link may help. You may also find this howto useful.
May 31 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
2428
by: Targa | last post by:
I have an ASP scheduling application in which there are blocks of time, represented with a table, within another table which is the timeline. In other words, I have a table with a vertical timeline. Each row represents a 1/2 hour of time starting at 12 AM. The scheduled job is represented by another smaller table inside the timeline table which spans vertically the time alloted for the job. Say if the job was scheduled for 2 hours, the...
2
4327
by: SamSpade | last post by:
There seems to be two ways to put things on the clipboard ( I don't mean different formats): SetClipboardData and OleSetClipboard If I want to get data off the clipboard do I care how it was put there? What about Drag/Drop; is there more than one way for the source to make data available Is it always OLE?
3
10405
by: Ajay Krishnan Thampi | last post by:
I have a slight problem implementing 'drag and drop' from a datagrid to a tree-view. I have pasted my code below. Someone please advice me on what to do...pretty blur right now. ==code== using System; using System.Drawing; using System.Collections; using System.ComponentModel;
1
1409
by: Ramesh Chawla | last post by:
Hi, I have to implement the functionality like 'drag n drop' in asp.net form. It is like, a table will be shown to the user at the client side. the first and last column of the table at the client is bound to some data. This data is made to be darg n drop. The drag and drop should be implemented in client side JavaScript and all the validations are need to performed at the client side, so I need to have some of the datatable data at the...
19
25459
by: Owen T. Soroke | last post by:
Using VB.NET I have a ListView with several columns. Two columns contain integer values, while the remaining contain string values. I am confused as to how I would provide functionality to sort columns based on the column header the user has clicked in both Ascending and Descending formats.
3
10592
by: VB Programmer | last post by:
In VB.NET 2005 (winform) any sample code to drag & drop items between 2 listboxes? Thanks!
1
4712
by: Darren | last post by:
I'm trying to create a file using drag and drop. I want to be able to select a listview item drag it to the shell and create a file. Each icon in the listview represents a blob in a database. When I drop onto the shell I want a file created with a specified name containing the data from the database. I've looked at the FileDrop format but it look to have only the filename and not the data. TIA
2
1815
by: amitsaxena1981 | last post by:
hi, I am using asp.net2.0 with vb.net , I have to create gridview user control and I want to drag and drop a record to a different position in the same Gridview using AJAX .Is it possible to implement this feature in gridview please help me its urgent and suggest the logic which i have to implement. Thanks & Regards Amit
5
13781
by: Romulo NF | last post by:
Greetings, I´m back here to show the new version of the drag & drop table columns (original script ). I´ve found some issues with the old script, specially when trying to use 2 tables with drag&drop on the same page (which was not possible). Now i´ve a new concept of the script, more object oriented. I´ve also commented the whole code so you guys can easier understand it engine. What exactly we need when trying to make a column drag &...
0
8680
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8609
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9030
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8899
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8871
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6528
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5861
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
2
2335
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2007
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.