By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,446 Members | 3,120 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,446 IT Pros & Developers. It's quick & easy.

How to make a cell in a table word-wrap

P: 57
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
Share this Question
Share on Google+
2 Replies


Ranjan kumar Barik
P: 95
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

P: 57
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

Post your reply

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