Table column widths

Task - clone existent table without first head row.
Problem: column widths are not equal.
<html>
  <body>
  <div id='div1'>
    <table cellpadding='5' cellspacing='0' border='1' id='table1'>
      <tr>
        <td>#</td>
        <td>Cell content</td>
      </tr>
      <tr>
        <td>1</td>
        <td>text text text text text</td>
      </tr>
    </table>
  </div>
  <script type='text/javascript'><!--
    function test() {
      table1 = document.getElementById( 'table1' );
      table2 = table1.cloneNode( true );
      div = document.getElementById( 'div1' );
      div.appendChild( table2 );
      arr = [];
      row0_cells = table1.rows[0].cells;
      for ( i=0; i < row0_cells.length; i++ ) {
        arr.push( row0_cells.clientWidth );
table2.deleteRow( 0 );
for ( i=0; i < arr.length; i++ ) {
cell = table2.rows[0].cells[i];
cell.style.width = arr[i]+'px';
--></script>
<br><br>
Test
</body>
</html>

http://www.dannyg.com/ref/javavsjavascript.html

Similar Messages

  • How to stop table columns widths from drifting

    I discovered that all the columns widths of my tables change on their own,
    leading me with tables of different columns widths where I wanted to
    maintain a strong cohesion of presentation among them.
    Here is a scenario to reproduce and understand the problem:
    • create a new Pages'08 document;
    • insert a Table;
       the 3 columns of this newly created table are 5.49 cm width each.
    Problematic case:
    • change the first column width with:<pre> Table > Table > Column Width > 5 cm</pre>   and hit return
    • the column width will switch to 5.01 cm
    • the 2 other columns widths will have switched to 5.50 cm.
    Is there a technique, I didn't find yet, to define a table column to a
    fixed value so that Pages'08 won't make it drift and wont touch to
    other columns width?
    <pre>--------
    As long as you'll see students making graphics with pen on paper,
    you'll see the missing keystone of the software empire.
    dan</pre>

    Peter, Fruhulda, thank you for your analysis and confirmation.
    PeterBreis0807 wrote:
    daniel
    I have noticed the same thing and have given up on it.
    It's a mess.
    I can't say it more politely .
    Let Apple know:
    -> https://bugreport.apple.com/
    <pre>--------
    As long as you'll see students making graphics with pen on paper,
    you'll see the missing keystone of the software empire.
    dan</pre>

  • How to fix Classic table column width / length fix ?

    Hi,
    I have a page for display purpose. In this page I am showing record.
    My requirement is to make Description column width fix. If data of description is huge then height will increase but not the length / width.
    Currently width property is 100%.
    Table is attached to VO.
    How to it ?
    Regards,
    Ajay

    Ajay ,
    I was looking into the two screen shots , i also had a close look at “Device Description” and “UDID " columns .
    I have also tried in my Jdeveloper it was not working . But it works fine if you change item style from styled text to
    message text input . I want you to try one more thing , since it work fine for message text input , change item style
    to message text input and set Read Only property to ' TRUE' and check .
    Keep size as same as you did before :
    Height :- 2
    Width :- 30
    Keerthi

  • Why can't I adjust table column widths at dev time?

    LV8 on XP:  I get the column separator pointer, <-||->, but when I click and attempt to drag,
    nothing happens.  Checking "Moveable Column Separators" on the
    pop-up menu has no effect (as expected, Help says its for run time).

    Another thing you can do is press CTRL-M to change to run-time mode.  In this mode, the front panel controls behave as through they were running. 
    I really like this mode and often use it for an inital mock-up.  of course since it is not really running, property nodes, invoke node, events, and locals will have no effect, but it does let you play with things and see controls "work" without having any code behind it.
    Hope that this helps,
    Bob Young
    Bob Young - Test Engineer - Lapsed Certified LabVIEW Developer
    DISTek Integration, Inc. - NI Alliance Member
    mailto:[email protected]

  • To change the width of a Table Column

    Hai Developers..................
    I have problem with the Table Column Width.
    When am on search state.
    The search results are showing in a table.
    At that time i want to change the width of the each column with respect to the column content.
    Like the jsp table.......
    Pls replay with example......
    Thanks.

    And that is why Swing related questions should be posted in the Swing forum so we don't spend time guessing what you are talking about.
    Darn, the [Table Column Adjuster|http://www.camick.com/java/blog.html?name=table-column-adjuster] didn't show up in that Google search.

  • Need custom column widths in Append Text Table to Report

    I need to print reports with tables of different column widths specified for each column, as the contained fields vary in width from just 3 characters in one column to 40 characters in another.  Also we are trying to match the reports generated by a non-labview routine.  In the past I have been able to achieve this by editing the Append Table to Report vi, working my way through the inner hierarchy to replace the DBL numeric COLUMN WIDTH control with a DBL numeric array.  The innermost vi, Set Table Column Width, assigns the numeric to a property node in a for loop, so the change is simple: replace the scalor with an array and enable indexing on the for loop.  Of course, after each Labview upgrade, I've had to go back in and repeat these edits on the overwritten upgraded vi's.  This time there is a problem.  The new version of this toolkit is object oriented, and disturbing these vi's wrecks the class methods in a way I don't understand (mostly because I've had no dealings with object oriented programming) and which cannot be undone.  I recently tried this and after not being able to fix the problem even with phone support, I had to spend the next two days unistalling and reinstalling Labview!  I desperately need a way to achieve this functionality without killing the toolkit, which is used (in its original functionality) by another absolutely critical program.  PLEASE HELP!
    The hierarchy is as follows:
    NI report.lvclass:Append Table to Report (wrap)
    NI report.lvclass:Append Table to Report 
    NI Standard report.lvclass:Append Text Table to Report
    NI Standard report.lvclass:tables
    NI Report Generation Core.lvlibet Table Column Width

    There is a highly relevant thread under discussion here:
    http://forums.ni.com/ni/board/message?board.id=fea​tures&thread.id=429
    You may wish to read it and chime in as it is a discussion of LabVIEW's policy (and possible change in policy for the future) concerning the handling of non-palette VIs between LV versions.
    Rob Hingle wrote:
    > Is that to say NI will not be helping me with this?  Pretty disappointing lack of support, seems
    > like a terrible idea to go to object oriented if even your own application engineers can't figure
    > out such a simple fix.  Gotta give NI a huge thumbs down on this one, thanks for nothing.
    I doubt that it is a simple fix -- our AEs are generally top notch at figuring out solutions for customers -- if it were simple, my bet is they'd have solved it. Asking an AE to work around a bug is different from asking them to rearchitect the toolkit. You are asking them to add a feature that the new version of the toolkit is not
    designed to support. The difficulty in doing this is completely independent of the decision to use LabVIEW classes to implement the toolkit. If any piece of software is not designed with a particular use case in mind, what may be a simple tweak under one design may become a very hard problem under another design.
    In your case, the solution is very straightforward: Use the older version of the toolkit. Any time you create a custom modification of the VIs that ship with LV or one of its toolkits, you should make your own copy and have your VIs link against the copy. LabVIEW promises to maintain all the public functionality version over version. Usually we succeed at that. What we do not promise is to maintain our private implementation of that functionality. It is impossible for LabVIEW (or any other software library) to maintain all of its private internal operations while still continuing any development. Using a copy of the original VIs shields you from having to recode your changes every version (something you've already mentioned is a chore) and it guarantees that functionality that you relie upon does not disappear.
    I hope you are willing to be understanding of this situation and not hold it against the AEs working on this. They try hard to provide excellent customer service, and spend lots of time inventing custom solutions for our users.  This happens to be a situation where the correct fix is not to modify the new toolkit version to do something it wasn't designed to do but to modify your development process so that the problem is solved now and into the future. 

  • How to set column widths in tables for selected table only, not globally throughout document?

    I've been utilizing the below script (thank you so much Ramkumar. P!) to set column widths throughout a sizable InDesign book with tables on every page and it is truly a time saver. At this point in time, I have three versions of it because there are different column widths throughout the book. Is it possible to augment the script to run only on a selected text frame (containing a table)? If so, would someone be kind enough to share the augmented script with me? I've been trying to figure out this seemingly simple change through trial and error with no success as yet. I realize this is a totally newbie request and I'm entirely at the mercy of the kindness of the Javascript gods that contribute within this forum. Seeing that in a different post related to this script, one such guru responded to a request as simple as "Where do I put the scripts in InDesign" gave me enough courage to ask for some help! Thank you in advance to anyone willing to provide a solution.
      var myDoc = app.activeDocument;
         var myWidths = [100, 100, 150, 150];
         for(var T=0; T < myDoc.textFrames.length; T++){
             for(var i=0; i < myDoc.textFrames[T].tables.length; i++){
                 for(var j=0; j < myWidths.length; j++){
                     myDoc.textFrames[T].tables[i].columns[j].width = myWidths[j];
         alert("Table width updated successfully...");

    Hello all
    I have the same problem in that I'm not a scripting person, but was able to get the above script working without problem, and it does set irregular table column widths perfectly, so thanks to Ramkumar. P for that.
    BUT, it changes the column width for ALL tables in the document, whereas I would like to just target the selected table.
    Any ideas as to how I might amend this script to achieve this?
    Thx, Christian

  • Column width issue in SharePoint 2010 Reports using SSRS webpart

    Dear sir,
    We need to adjust column width for output of reports. We are using SSRS webpart to generate reports. It is taking unexpected column width.
    We show that dynamically we cannot set the column width but we are passing the query statically is there any way or chances to mange column width.
    Please help.

    If it's important, I'd suggest ringing Microsoft Premier Support and logging a call.  The working world is probably just getting back to their offices.
    For both columns, you can think about some JQuery to isolate the appropriate selectors and just reside them in the page rendering.  You'll need JavaScript enabled in your browser for this but this code within a CEWP should do the trick. 
    <!--ADJUST TABLE COLUMN WIDTH-->
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js"
    type="text/javascript"></script>
    <script type="text/javascript">
    $(function(){
    $("TH.ms-vh2-nograd:contains('Status description')").css("width", "150px");
    $("TH.ms-vb:contains('Type of Work')").css("width", "150px");
    </script>
    You'll need to link to a JQuery instance of course and change the capture text for your columns.
    Credit to the code to Kjell-Sverre Jerijærvi from his
    blog post.
    Steven Andrews
    SharePoint Business Analyst: LiveNation Entertainment
    Blog: baron72.wordpress.com
    Twitter: Follow @backpackerd00d
    My Wiki Articles:
    CodePlex Corner Series
    Please remember to mark your question as "answered" if this solves (or helps) your problem.

  • How to optimize the column width in Table Control

    Hi all,
          When I am displaying fields in Table Control, the columns are displayed in full length, and I am unable to see all the fields at once.
    So as in grid , where we optimize the column width using layout, do we had any property for TC to do so.
    thanks for your help.
    Points would be awarded .
    Regards,
    Anil .

    Hi,
    In Se51, you can do this one, ust open your table control and resize the TC, there is no direct option to do this for entire TC, you need to do this field by field, and arrage the TC to adjust in a Single screen. In the field parameters, you have the field lenghts, there you can minimize the length of a field
    Regards
    Sudheer

  • How to set initial column widths for a table

    What I'd like to do is to control the initial column widths for a table.
    I'm building the table by using a class which extends AbstractTableModel. This class takes care of setting the headers and reading the data for the table.
    If I do the following:
    VarTableModel vtm = new VarTableModel(vi);
    JTable jt = new JTable(vtm);
    JScrollPane jsp = new JScrollPane(jt);
    frame.getContentPane().add(jsp);
    frame.setVisible(true);
    I will see a table in my window. The widths of the columns are equal and are a function of the horizontal dimension of the window.
    I have tried to set the width of a column by doing the following:
    TableColumn aColumn;
    aColumn = jt.getColumn(vtm.getColumnName(0));
    aColumn.setWidth(40);
    But this has no effect on what gets displayed. I can force the widths that I want by using 'setMaxWidth' but this has the unfortunate side effect of not allowing the user to make the column wider if they want.
    What I'd like is a way to specify the widths of the columns when initially displayed and then let the user adjust to their liking.
    I'm sure that there is a way to do this, but I don't seem to understand where to intervene in the process to produce the effect that I want.
    Any help or suggestions will be greatly appreciated!

    Table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
    add this line and try ur codeThanks for the suggestion! Unfortunately, it doesn't seem to do the trick. Here is an abbreviated segment of my code:
    vtm = new VarTableModel(vi);
    JTable jt = new JTable(vtm);
    // we want a horizontal scrollbar, so turn resizing off
    // and we want to control column widths
    jt.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
    aColumn = jt.getColumn(vtm.getColumnName(0));
    aColumn.setWidth(40);
    . // same kind of thing for each column
    aColumn = jt.getColumn(vtm.getColumnName(4));
    aColumn.setWidth(400);
    JScrollPane jsp = new JScrollPane(jt);
    frame.getContentPane().add(jsp);
    frame.setVisible(true);
    If I do the above, the table gets displayed with each of the five columns the exact same width. So, the sizing of the columns is happening somewhere else despite turning auto resizing off.
    Where is that occurring and how can I intervene so that I can control the widths of the columns on initial display and still allow the user to adjust the widths if they so choose?

  • How do I get text inside a table column to stretch the whole column width?

    Hi I am using JDeveloper Studio Edition Version 11.1.1.0.2.
    I have some tables where one of the columns are quite wide (700px) wide and some quite narrow 50px. It doesn´t look pretty. The input text inside the 50px column looks like it stretches out of the column and the inputtext in the 700px column leaves a big empty space in the right side of the column. What I had hoped for is columns which have the same padding to its content as a 100px column no matter the columns width. How do I do that? Do I have to use skinning?

    Well I don´t want the space on both sides of the input text to be that big either so that doesn´t solve the problem.

  • How to control column width in table?

    I have a table with four columns, and they are all with same width.
    But I want to make one of them wider.
    How should I do?
    public void loadTable(){
    Vector infoList = myObj.getInfoList();
    Info info;
    DefaultTableModel dtm = (DefaultTableModel)myPanel.tblList.getModel();
    String[] columnNames = {
    "wider column",
    "Column B",
    "Column C",
    "Column D"};
    dtm.setColumnIdentifiers(columnNames);
    for(int i=0;i< infoList.size();i++){
    // add stuff to "data"
    dtm.addRow(data);
    myPanel.tblList.setModel(dtm);
    myPanel.tblList.getColumnModel().getColumn(1).setWidth(100);
    I also tried setPreferedWidth(), not working for me either.
    What should I do?
    Thank you

    Try setting all the column widths. Define values for normal and width columns:
            DefaultTableColumnModel tcModel = (DefaultTableColumnModel) myTable.getColumnModel();
            Enumeration columnEnum = tcModel.getColumns();
            while (columnEnum.hasMoreElements()) {
                TableColumn column = (TableColumn) columnEnum.nextElement();
                if (column.getModelIndex()  != 1) {
                    column.setPreferredWidth(narrowWidth);
                } else {
                    column.setPreferredWidth(wideWidth);
    Cheers
    DB

  • Change column width for print table to report

    Hi, want to make the first column in my table to be printed to report wider than the rest, for it contains the part numbers of about 16 chars and the other columns are the data of 4 each. Don't want to make all equally wide for I want to fit as many column as possible over the page. How can I do this?? Thanks for any help. Is there maybe another way to print in a table format?? Madri

    Hi Madri,
    Assuming you are using the Standard Report type with the Report Generation VIs, you can check out this KnowledgeBase entry that discusses how to customize the VI to generate a report with different column widths:
    http://digital.ni.com/public.nsf/websearch/7AEC2CC2618D47DF86256D280058BDA5
    Hope this helps,
    -D
    Darren Nattinger, CLA
    LabVIEW Artisan and Nugget Penman

  • Autofit column width to table cell content in Pages

    Hello,
    Would anyone know how to autofit the column width of a table cell in Pages '09?
    I have searched Pages Help to no avail.
    Thank you very much in advance.

    There is a checkbox in the table inspector to auto-resize to fit content. Unfortunately, that only seems to work with rows, not columns.

  • How to fix the table column header and resize the width of a table column?

    Hi all,
    I have the following two requirements,
    1) I need to wrap the table column header into two rows. I mean the header must be displayed in two rows.
    2) I need to to able to resize the width of the column. i.e The user should be able to drag the column width according to his requirement.
    Is this possible. Any help would be appreciated!
    Regards
    Kishan

    Hi Kishan,
    Refer to these links.They may ne useful for you.
    https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/80d81237-b780-2a10-d398-cc33af6bd75c
    https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/ded11778-0801-0010-258f-ac3b9408a194
    https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/30291df2-b980-2a10-0884-839c4f7f147e
    Regards,
    Sumangala

Maybe you are looking for