• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Dynamically Adding & removing rows

 
RAVI KHARVI
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 261
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Indeed. And what exactly do you want to control dynamically?
 
Muhammad Saifuddin
Ranch Hand
Posts: 1324
Android Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ravi,

Welcome to Javaranch.

I would like to suggest some reading about Use A Meaningful Subject Line and Tell The Details.
 
Anirvan Majumdar
Ranch Hand
Posts: 261
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 269
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic