Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > How to display a list box in a table cell after selection?

Reply
Thread Tools

How to display a list box in a table cell after selection?

 
 
tomix
Guest
Posts: n/a
 
      10-23-2006

I am writing an editable grid control and i need
to move a list box from one cell to the other
after the user select to edit the cell,the list box will display
available options for the column


how can i do it with java script? i mean what is the best way to move
an item between cells?

Thanks in advance

 
Reply With Quote
 
 
 
 
Martin Honnen
Guest
Posts: n/a
 
      10-23-2006
tomix wrote:

> i mean what is the best way to move
> an item between cells?


You can move any node to a new parent by simply doing e.g.
newParent.appendChild(node)
e.g.
someCell.appendChild(selectElement)
as calling appendChild with an argument that is already inserted
somewhere in the DOM tree first removes it from its old parent and then
inserts it as a child of the new parent. The same holds for other
methods like insertBefore.


--

Martin Honnen
http://JavaScript.FAQTs.com/
 
Reply With Quote
 
 
 
 
ASM
Guest
Posts: n/a
 
      10-23-2006
tomix a écrit :
> I am writing an editable grid control and i need
> to move a list box from one cell to the other
> after the user select to edit the cell,the list box will display
> available options for the column
>
> how can i do it with java script? i mean what is the best way to move
> an item between cells?


<script type="text/javascript">

function move() {
// the select to move
var original = document.getElementById('mySelect');
// the table
var table = document.getElementById('myTable');
// cell where to move to
var target = table.rows[3].cells[3];
// fire
target.appendChild(original);
}

</script>
 
Reply With Quote
 
tomix
Guest
Posts: n/a
 
      10-23-2006

Martin Honnen wrote:
> tomix wrote:
>
> > i mean what is the best way to move
> > an item between cells?

>
> You can move any node to a new parent by simply doing e.g.
> newParent.appendChild(node)
> e.g.
> someCell.appendChild(selectElement)
> as calling appendChild with an argument that is already inserted
> somewhere in the DOM tree first removes it from its old parent and then
> inserts it as a child of the new parent. The same holds for other
> methods like insertBefore.
>
>
> --
>
> Martin Honnen
> http://JavaScript.FAQTs.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
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
Linking a text box and/or a list box to an Access table's column. ryan.d.rembaum@kp.org ASP .Net 1 08-05-2005 04:17 AM
populate one list box with selected values from another list box steven.cooper@infocision.com ASP .Net 1 03-12-2005 11:29 PM
populating an asp list box from a simple access lookup list (single column not a table) gerry ASP .Net 0 04-24-2004 09:21 AM
How do I have a table cell fetch another page to display within the cell? Phillip Roncoroni HTML 14 04-05-2004 05:58 PM



Advertisments