473,467 Members | 2,005 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

How to make a cell in a table word-wrap

57 New Member
1. My boss wants me to make the text in my table cells 'wrap' which means become multiline if the string is longer than the cell width.

Here is how I make the elements with this data, where 'data_value' is the string that
will show up in the table:

var tdElem = document.createElement("td");
tdElem.className = className;
txtNode = document.createTextNode(data_value);
tdElem.appendChild(txtNode);
tdElem.id=Id;

then later on this tdElem thing gets appended to my row:
trElem.appendChild(tdElem);

2. Well maybe this needs to be a separate question. But once my table gets over a few thousand rows my resize and sort are slow as molasses. I am desiring to replace an existing infragistics grid which can handle this many rows without wigging out. I bascially just found table sort and resize examples on the web and imitated them. My question is , in general, am I going to be successful in javascript client side only logic and what kind of design do I need to do it? I am using quick sort, and changing the widths of all my elements for the resize. Is there some means of creating html using the infragistics and adding it somehow to my table's innerhtml?
Jan 22 '08 #1
2 4771
Ranjan kumar Barik
95 New Member
1. My boss wants me to make the text in my table cells 'wrap' which means become multiline if the string is longer than the cell width.

Here is how I make the elements with this data, where 'data_value' is the string that
will show up in the table:

var tdElem = document.createElement("td");
tdElem.className = className;
txtNode = document.createTextNode(data_value);
tdElem.appendChild(txtNode);
tdElem.id=Id;

then later on this tdElem thing gets appended to my row:
trElem.appendChild(tdElem);

2. Well maybe this needs to be a separate question. But once my table gets over a few thousand rows my resize and sort are slow as molasses. I am desiring to replace an existing infragistics grid which can handle this many rows without wigging out. I bascially just found table sort and resize examples on the web and imitated them. My question is , in general, am I going to be successful in javascript client side only logic and what kind of design do I need to do it? I am using quick sort, and changing the widths of all my elements for the resize. Is there some means of creating html using the infragistics and adding it somehow to my table's innerhtml?
Hi,
You are assigning a class to the cell, then just add
Expand|Select|Wrap|Line Numbers
  1. word-break:break-all;
  2.  
to your class declaration. I hope it will work.

Happy programming!
:)
Jan 23 '08 #2
jhaxo
57 New Member
Hi,
You are assigning a class to the cell, then just add
Expand|Select|Wrap|Line Numbers
  1. word-break:break-all;
  2.  
to your class declaration. I hope it will work.

Happy programming!
:)
Thanks, It is working. I had to also have table-layout:fixed;, which I found after googling with your word-break:break-all

My ide, visual studio 2005, does not think word-break is a valid css element but its working.

Do you have any idea about question 2
Jan 23 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Joe Conlin | last post by:
I am truncating data from an SQL database and have a script that populates a cell. The problem that I have is I have HTML tags in my database so if the data gets truncated in the middle of a tag,...
82
by: Peter Diedrich | last post by:
The site design is pretty simple: ============================================ | Head | ============================================ | | ...
6
by: tshad | last post by:
I have a cell with 2 items in it: a textbox and a link. The link is actually a button (image), but for the example I am using a link, which is doing the same thing. Here is the stripped down...
4
by: HB | last post by:
So I have a table in ASP.NET <table runat="server" id="tblMyTable"> <tr> <td id="cellMyCell">word</td> </tr> </table> How do I reference the cell "cellMyCell" from the Vb.NET 1.1...
7
by: SteveM | last post by:
I am sure this is an easy question, but being relatively new to ASP.NET programming, I can not quite grasp what I need to accomplish what I need to do. What I have is a word document that is...
8
by: active | last post by:
I have a table on my page with rows and cells. I try to drag a table from the toolbox into one of the cells but the drag symbol shows it is not allowed (and the table does not drop) Can I...
0
by: pmeems | last post by:
This is my first post to this group. So I say hello to all members. I'm in the process of converting my C# early binding of MS Word to late binding so I don't have any trouble running my...
7
by: buntyindia | last post by:
I have the following scrollable table I have to implemet a functionality that I can select a row in it & display that data in popup window.. Any hints/example or similar available implementation?...
4
by: karen987 | last post by:
I have a column in a table, which draws out info from a database. The column is 150px wide. I want it to remain this wide, even if one word is longer. What happens now is that if i put in a web...
2
by: Jukka K. Korpela | last post by:
Sub titulo "Re: DIV borders different in IE7 when in td" scripsit Ben C: This seems to be the heart of the matter, and I'm trying to get a real discussion started, by moving the discussion to...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.