• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Table Cell Deletion Challenge

 
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This problem I have been trying to solve for the past few days. So javascript experts ---> try it, coz no forums / sites have the solution.

Consider a simple HTML table with tr td tags. Now make it a bit complex by adding rowspans and colspans.

When you try to delete a column which already spans some column it should delete the spanned columns also. It's like in excel when you select a cell and say "Delete-->Entire column", it deltes the related cells for example

A F
B D G
C E H

So if I delete A then both the columns "BC & DE" should get deleted. This should be done via javascript. What I am doing is before deleting trying to decrease row spans and col spans of each cell to one, and creating empty cells in it's place. Before it decreases the spans it tries to note down the number of linked cells. So structure becomes something like

A (Blank) F

B D G

C E H


Now if I delete A then I should delete the next side column also. Again after deleting it, it will restore the table to it's original state. Meaning --> RowSpan and colspan of other cells will be restored to their original values. Obviously this method is complex and causes some errors.

Is there any other way to achive this excel deletion functionality?

Anybody tried it??

lemme know.....


Thanks,
Animesh
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Look into colgroup and removing the elements from view with CSS

Eric
 
Marshal
Posts: 67447
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by Animesh Saxena:
try it, coz no forums / sites have the solution.


Please use real words when posting to the forums. Abbreviations such as "coz" in place of "because" only serve to make your posts more difficult to read and less likely to generate useful responses.

Please read this for more information.

thanks,
bear
JavaRanch sheriff
 
Destroy anything that stands in your way. Except this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic