Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > please help

Reply
Thread Tools

please help

 
 
kalikoi@gmail.com
Guest
Posts: n/a
 
      12-21-2005
Hi All

I had an HTMLpage with a table consisting of 5 columns

the first two columns are images add and delete

on the page load i have only one row for the table

when i click the add button then a clone is created below it

not what i want is as soon as i add some rows and fill them with
numeric values

and click the ok button

the table should be sorted basing on the values of the third column


here the code

<html>
<head>
<title>Custom Deciling</title>
<script type="text/javascript">
function cloneRow(theCell)
{
if( document.createElement && document.childNodes )
{
var thisRow = theCell.parentNode;
var newElement = thisRow.cloneNode(true);
thisRow.parentNode.insertBefore(newElement,thisRow .nextSibling);
var nr = document.frmadd.textmin.length
cleanRow(newElement,nr);
}
}
function cleanRow(n,p)
{
if (n.id)
n.id = n.id.split('-')[0] + '-' + p;
if (n.name)
n.name = n.name.split('-')[0] + '-' + p;
if (n.value)
n.value = '';
for (var i=0; i<n.childNodes.length; i++) {
cleanRow(n.childNodes[i],p);
}
}
function deleteRow(theCell)
{

var nr = document.frmadd.textmin.length
if (nr==undefined || nr==1)
{
alert("Operation Cannot be Performed");
return;
}
else
{
if( document.createElement && document.childNodes )
{
var thisRow = theCell.parentNode;
thisRow.parentNode.removeChild(thisRow);
}
}
}
</script>
</head>
<body bgcolor="#00265c" >
<form name="frmadd">
<table border="0" align=center>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td align=center><Font face=verdana color=yellow
size=1>Min</font></td>
<td align=center><Font face=verdana color=yellow
size=1>Max</font></td>
<td align=center><Font face=verdana color=yellow
size=1>Decile</font></td>
</tr>
<tr>
<td onclick="cloneRow(this);"><img src="../../images/add.gif"
border="0" WIDTH="51" HEIGHT="23"></td>
<td onclick="deleteRow(this);"><img src="../../images/delete.gif"
border="0" WIDTH="51" HEIGHT="23"></td>
<td><input type=text name=textmin size=5 value=""></td>
<td><input type=text name=textmax size=5 value=""></td>
<td><input type=text name=textdecile size=5 value=""></td>
</tr>
</table>
<br>
<center><input type=button value=ok name=ok size=5
onclick=checkboxes()></center>
</form>
</body>
</html>

<script language=javascript>
function checkboxes()
{
///here the scripting should be done which sorts the table basing on
the values in 3rd column
}
</script>

 
Reply With Quote
 
 
 
 
VK
Guest
Posts: n/a
 
      12-21-2005

http://www.velocityreviews.com/forums/(E-Mail Removed) wrote:
> the table should be sorted basing on the values of the third column


Unless you're using a data bound table, table sorting is a rather
complicated task. For some inspitation ideas you may look at
<http://www.mattkruse.com/javascript/sorttable/>

Data bound table doesn't need scripting at all, but unfortunately it is
still IE-only.

 
Reply With Quote
 
 
 
 
Lee
Guest
Posts: n/a
 
      12-21-2005
(E-Mail Removed) said:
>
>Hi All
>
>I had an HTMLpage with a table consisting of 5 columns


You've posted this once with the subject "urgent"
and now again with the subject "please help".
In these newsgroups, we can assume that a new post is asking for help
of some sort. The subject line should tell us what it is that you're
asking about.

 
Reply With Quote
 
Matt Kruse
Guest
Posts: n/a
 
      12-21-2005
VK wrote:
> Unless you're using a data bound table, table sorting is a rather
> complicated task. For some inspitation ideas you may look at
> <http://www.mattkruse.com/javascript/sorttable/>


Actually, I recommend against it. I'm taking that lib down, as it was
written back in Netscape 4.x days when sorting tables was considerably more
complex. These days, there are better solutions...

--
Matt Kruse
http://www.JavascriptToolbox.com
http://www.AjaxToolbox.com


 
Reply With Quote
 
 
 
Reply

Thread Tools

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Please please please help this guy with his open source java app casioculture@gmail.com Java 4 05-05-2005 08:24 AM
Console profile for Windows app in VC++ - PLEASE PLEASE PLEASE HELP! MuZZy C++ 7 01-07-2005 08:40 PM
Computer problems please please please help Nick Computer Support 0 06-04-2004 08:49 PM
HELP! HELP! PLEASE, PLEASE, PLEASE tpg comcntr Computer Support 11 02-15-2004 06:22 PM
please help... ...me learn C++ please please please :) KK C++ 2 10-14-2003 02:08 PM



Advertisments