aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes Dynamically Adding  & removing rows Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Dynamically Adding  & removing rows" Watch "Dynamically Adding  & removing rows" New topic
Author

Dynamically Adding & removing rows

RAVI KHARVI
Greenhorn

Joined: Apr 03, 2008
Posts: 2
inserting /Removeing rows elements in javascript

[ April 04, 2008: Message edited by: RAVI KHARVI ]
[ April 05, 2008: Message edited by: RAVI KHARVI ]
Anirvan Majumdar
Ranch Hand

Joined: Feb 22, 2005
Posts: 261
Indeed. And what exactly do you want to control dynamically?
Muhammad Saifuddin
Ranch Hand

Joined: Dec 06, 2005
Posts: 1321

Hi Ravi,

Welcome to Javaranch.

I would like to suggest some reading about Use A Meaningful Subject Line and Tell The Details.


Saifuddin..
[Blog][Linkedin] How To Ask Questions On JavaRanch My OpenSource
Anirvan Majumdar
Ranch Hand

Joined: Feb 22, 2005
Posts: 261
Originally posted by RAVI KHARVI:
how to add or remove rows in javascript at dynamicaly


Well,
1) You could represent every row as a separate table giving each table a unique id. And then toggle around with the table's style.display property to show and hide the tables.
2) Instead of having separate tables for every row, you can try and toggle with the style.display property of the <tr> elements. This will work fine with IE but other browsers don't really allow this behaviour. For cross browser operation, you can try changing the className of the <tr>'s: where one class has a property {display:none;} and the other has nothing.
3) You can alter the innerHTML property of the table, but this is often very cumbersome.
[ April 04, 2008: Message edited by: Anirvan Majumdar ]
Bryce Martin
Ranch Hand

Joined: Nov 19, 2007
Posts: 269
Take a look into JQuery. You should use 1 table. Each row should have a unique id. Then you can do something like... $('#'+id).remove();

You could also look into jqGrid. It has row adding and deleting features. It is a plugin to JQuery. So I would start here.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Dynamically Adding & removing rows