Column Widths - Script UI Problems

Upon further review I realized that the method provided on page 28 of the Beginning Script Revision 1.9, January 2012 for creating a multi column listbox doesn't behave in application as it does in documentation.
On the next page Peter provides a clearly superior method for creating multi column listboxes.
However what I'd like to be able to do is create a multicolumn list box, with predefined column widths, where the column separator position can still be adjusted by the user. Is it possible to get this behaviour? A script illustrating the problematic behaviour is provided below, and below that is a capture image of the behaviour desired.
Again any and all help with this matter is appreciated.
var w = new Window ("dialog", "Tool",undefined,{});
var panel2 = w.add ("panel");
panel2.add ("statictext", undefined, "Results:");
var resultsListbox = w.add ("listbox", undefined, undefined,
        {numberOfColumns: 2, showHeaders: true, columnTitles: ['Document', 'Keyword'], columnWidths: [100,100,100]});
        resultsListbox.minimumSize = [300,300]
var myButtonGroup3 = panel2.add("group");
var saveButton = myButtonGroup3.add ("button", undefined, "Save");
var searchButton = myButtonGroup3.add ("button", undefined, "Search");
var exitButton = myButtonGroup3.add ("button", undefined, "Exit");
w.show();

Hi KuddRoww,
You have two problems:
(1) it looks like the columnWidths are not preprocessed as long as the listbox is empty;
(2) a listbox has an "extra room" over the last column, but this extra room is not a column in itself and it's not easy to control its specific width.
To solve (1) you just have to temporarily feed the list with a fake item, run the autolayout to get the columns sized, then remove the item.
Solving (2) is not easy because the default extra space depends on the OS, but we can suppose it is around 18 pixels.
Here is a possible starting point:
var DESIRED_WIDTH = 300,
    COL1_WIDTH = 100,
    EXTRA_WIDTH = 18; // Depends on the OS
var w = new Window ("dialog", "Tool",undefined,{});
var panel2 = w.add ("panel");
panel2.add ("statictext", undefined, "Results:");
var resultsListbox = w.add ("listbox", undefined, [' '/*fake item*/],
        numberOfColumns: 2,
        showHeaders: true,
        columnTitles: ['Document', 'Keyword'],
        columnWidths: [COL1_WIDTH, DESIRED_WIDTH - COL1_WIDTH]
resultsListbox.minimumSize = [1,DESIRED_WIDTH];
var myButtonGroup3 = panel2.add("group");
var saveButton = myButtonGroup3.add ("button", undefined, "Save");
var searchButton = myButtonGroup3.add ("button", undefined, "Search");
var exitButton = myButtonGroup3.add ("button", undefined, "Exit");
// Pre-layout
w.layout.layout(0);
// Remove the fake item
resultsListbox.remove(0);
// Fine-tuning
resultsListbox.maximumSize = [
    resultsListbox.size[0]-EXTRA_WIDTH,
    resultsListbox.maximumSize[1]
w.show();
@+
Marc

Similar Messages

  • 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.

  • Column width in Excel BPS

    Hi,
    I have a BPS layout with a largest value in a cell of one column. The amount is represented by ######### because the column is not open to show the value.
    The formatting options "Controlling column width" is selected, if I deselect this option is worst.
    The user can’t fit the column width; the column is not protected.
    The largest amount is generated by an excel formula.
    What can I do?
    Thanks
    Victoria

    Or <u>after</u> the Layout component in the web interface builder assign a text/html-component with html=true and following script, where you can hardcode the column width
    <script language="JavaScript" type="text/javascript">
    <!--
      var layout_id = "<b>LayoutXXX</b>";
      layout_sheet = getBpsExcel( layout_id );
      if (layout_sheet && layout_sheet.ActiveSheet) {
    // OPEN Excel OWC FOR CHANGE
        layout_sheet.ActiveSheet.Protection.Enabled = false;
    // SET RANGE (ROW,COL) TO (ROW,COL)
    // CHANGE PARAMETERS
        range = layout_sheet.Range(layout_sheet.Cells(1 ,1 ),
                layout_sheet.Cells(100 ,100 ));      
        <b>range.Columns.ColumnWidth = 10</b>;
    //PROTECT THE SHEET AGAIN
        layout_sheet.ActiveSheet.Protection.Enabled = true;
    -->
    </script>

  • Can I change a field/column width in a script ?

    Can I change a field/column width in a script to be run in SQL Plus? For example, I have a table where field COL1 is a varchar2(200). The table already has data in it. I would like to increase the width of field COL1 to be varchar2(300). Can I do this in a script ? Thank you.

    No problem
    alter table MYTABLE modify ( col1 varchar2(300) );

  • ALV GRID Display Column Width problem when filtering

    Hello All,
       When i displaying ALV Grid Display ,i selected one column and set filter for that.
    the problem is column width at display is 12 charecters but in filter it is allowing only 10 charecters to enter which is wrong. i am unable to set filter.please give solution.
    Thanks
    Sandeep.G

    hello i am calling perform, ineed to set OUTPUTLEN according to field length how can i do that.
    FORM fill_fieldcat  USING  p_field TYPE slis_fieldcat_alv-fieldname
                               p_text  TYPE slis_fieldcat_alv-seltext_l
                               p_flag TYPE c.
      wa_fieldcat-fieldname    = p_field.
      wa_fieldcat-seltext_l    = p_text.
      wa_fieldcat-no_out  = p_flag.
       wa_fieldcat-outputlen = 20.
      APPEND wa_fieldcat TO i_fieldcat.
      CLEAR wa_fieldcat.

  • Apache FOP Problem with column width

    We are using Apache FOP to generate simple pdf documents out of reports.
    My problem is that the table in the pdf is as standard filled in with columns of same length.
    Further on the content of some table fields is to large or sometimes there is to much room.
    is there any possiblity to let fop react like html?
    The smallest table field size should be like the content. I don't want to adjust all my reports, cause there are really many reports with pdf printing.
    anyone an idea how to solve this with FOP?
    i have no BI pubisher or other reporting engines for this problem
    thx so far

    Oliver,
    I think what you're looking for is having your column width automatically adjusted based on the content of your column values. That is not possible with the built-in, generic XSL-FO template. What you can do is manually adjusting the column width to appropriate values on the print attributes page.
    Regards,
    Marc

  • Problems using "Edit Column Widths" feature in List View component

    Hello. I'm using a list view component (Xcelsius 4.5 Professional) to display a simple table of text from Excel. I want to adjust the width of the component colums so that all of them fit on the screen at the same time- regardless of how wide they are in the excel columns. The problem is the columns in excel are of variable length; I have no way to predict how wide they will be. The list view component always defaults to the widest column(s) so it ends up pushing some of the columns to the right and  I then have to use the scroll bar to see them. I thought the "edit column widths" would allow me to force the column widths in the component (potentially truncating some of the columns), but it does not work that way.
    How is the "edit column width" feature supposed to work? What does one enter in the value for each label? Are the units in pixels? When I start entering values I get all kinds of strange behavior...

    This was a great place for me to start
    Thank you
    I took profdant139's suggestions a bit further as my real goal was to have the "Document column" narrower. The goal to be able to see all the other document info that was usually hidden way out to the right
    To achieve my results I right clicked in the upper bar with the column names and chose from the drop down box "comments" column (as suggested). I then dragged it to the far right. This pushed all the other columns over.
    In the end of the day I ended up adding "Size" and "Date modified" columns as well to get my desired results.
    Remember one can move different columns around to be in the order you need by clicking on the column to get it active and then left click and drag it to where you want
    Another great thing is that by default (Using Mavericks) the date modified, opened,created columns have date and time. One can shrink them down to xx/xx/xx format by manually adjusting the column width like one does in Excel - click on column separator up top and drag
    Once all that is done, at least on my box, I closed it out and opened up a new finder window and everything was as I wanted.
    Thank you for the help  from the above helper to get me here

  • How to make a script for expand column width

    Hi experts,
    Is that possible to make a script for expand the column width aim to let the columns show up all the overset text?
    Regard
    John

    Hi John,
    As Uwe advised it would be wise to put a stop on any while loop in case the condition is never fulfilled which would mean the script will break.
    Without knowing what specifically you are working on you could make the below amendments to do this.
    myTables = app.documents[0].stories.everyItem().tables.everyItem().getElements();
    for (var t = 0; t < myTables.length; t++) {
        BE_resizeColumnsToFitContents(myTables[t], 200);
    function BE_resizeColumnsToFitContents(tableToEdit, tableMaxWidth) {
        for (var i = 0; i < tableToEdit.columns.length; i++) {
            while (tableToEdit.columns[i].overflows === true) {
                if (tableToEdit.width < tableMaxWidth) {
                    tableToEdit.columns[i].width += 1;
                    tableToEdit.columns[i].recompose();
                else {
                    alert("Column " + i + " contents too large for column.");
                    break;
    I won't put any extra functions in this because it might not be what you're after. To use this you just define the table width as a second argument to the function (but you could change this parameter to something else, like page, column or cell width). And, if you want to have a fail action you just put it in the 'else' part.
    Brett

  • Spanning columns in a grid messes up column widths

    Hi. I've been struggling with some layout issues when using
    column width percentages with the Flex Grid control. It seems that
    if I add a column that spans 2 or more columns, the column widths
    of the entire grid are altered. The strange thing is that the
    column widths are changed only if the text in the colspan column
    exceeds the width of the text in cells above or below it. Please
    see the code sample at the bottom of this message for a
    demonstration (I can't seem to find a way to "attach code").
    Does anyone have any ideas how to fix this?
    Thanks!
    Dustin
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="
    http://www.adobe.com/2006/mxml"
    creationComplete="init()" layout="vertical">
    <mx:Script>
    <![CDATA[
    import mx.containers.*;
    import mx.controls.*;
    import mx.core.*;
    import flash.utils.Timer;
    import flash.events.TimerEvent;
    private var dynamicText:Text;
    private var charCode:uint;
    private var button:Button;
    private function init():void
    var panel:Panel = createPanel();
    addChild(panel);
    addText(panel);
    addGrid(panel);
    addButton(panel);
    startTimer();
    private function timerComplete(event:TimerEvent):void
    button.enabled = true;
    private function createPanel():Panel
    var panel:Panel = new Panel();
    panel.title = "ColSpan Spacing Problem";
    panel.width = 500;
    panel.height = 200;
    panel.horizontalScrollPolicy = ScrollPolicy.OFF;
    panel.layout = "vertical";
    return panel;
    private function addText(panel:Panel):void
    var text:Text = new Text();
    text.text = "First row contains 5 columns with no col spans.
    Second row contains 4 columns with " +
    "column 2 spanning columns 2 and 3. Notice how the column
    widths are affected when the text " +
    "in the colspan cell grows larger than the text in the cell
    above it.";
    text.percentWidth = 100;
    panel.addChild(text);
    private function addGrid(panel:Panel):void
    var grid:Grid = new Grid();
    grid.setStyle("horizontalGap", "0");
    grid.setStyle("verticalGap", "0");
    grid.percentWidth = 100;
    panel.addChild(grid);
    // FIRST ROW
    var gridRow:GridRow = new GridRow();
    gridRow.percentWidth = 100;
    grid.addChild(gridRow);
    var gridItem:GridItem = new GridItem();
    gridItem.setStyle("borderStyle", "solid");
    gridItem.percentWidth = 1;
    gridRow.addChild(gridItem);
    gridItem = new GridItem();
    gridItem.setStyle("borderStyle", "solid");
    gridItem.percentWidth = 48;
    var text:Text = new Text();
    text.text = "No ColSpan Columns";
    gridItem.addChild(text);
    gridItem.colSpan = 1;
    gridItem.clipContent = false;
    gridRow.addChild(gridItem);
    gridItem = new GridItem();
    gridItem.setStyle("borderStyle", "solid");
    gridItem.percentWidth = 1;
    gridRow.addChild(gridItem);
    gridItem = new GridItem();
    gridItem.setStyle("borderStyle", "solid");
    gridItem.percentWidth = 13;
    gridRow.addChild(gridItem);
    gridItem = new GridItem();
    gridItem.setStyle("borderStyle", "solid");
    gridItem.percentWidth = 37;
    gridRow.addChild(gridItem);
    // SECOND ROW
    gridRow = new GridRow();
    gridRow.percentWidth = 100;
    grid.addChild(gridRow);
    gridItem = new GridItem();
    gridItem.setStyle("borderStyle", "solid");
    gridRow.addChild(gridItem);
    gridItem = new GridItem();
    gridItem.setStyle("borderStyle", "solid");
    gridItem.colSpan = 2;
    dynamicText = new Text();
    dynamicText.text = "A"; //IF THIS TEXT GROWS WIDER THAN TEXT
    IN THE ROW ABOVE, SPACING IS THROWN OFF
    gridItem.addChild(dynamicText);
    gridRow.addChild(gridItem);
    gridItem = new GridItem();
    gridItem.setStyle("borderStyle", "solid");
    gridRow.addChild(gridItem);
    gridItem = new GridItem();
    gridItem.setStyle("borderStyle", "solid");
    gridRow.addChild(gridItem);
    private function addButton(panel:Panel):void
    button = new Button();
    button.label = "Start Over";
    button.addEventListener(MouseEvent.CLICK, startOver);
    panel.addChild(button);
    private function startOver(event:MouseEvent):void
    startTimer();
    private function startTimer():void
    dynamicText.text = "A";
    charCode = 66;
    button.enabled = false;
    var myTimer:Timer = new Timer(250, 25);
    myTimer.addEventListener(TimerEvent.TIMER, timerHandler);
    myTimer.addEventListener(TimerEvent.TIMER_COMPLETE,
    timerComplete);
    myTimer.start();
    private function timerHandler(event:TimerEvent):void
    dynamicText.text += String.fromCharCode(charCode);
    charCode++;
    ]]>
    </mx:Script>
    </mx:Application>

    This seems to fix it.
    gridItem = new GridItem();
    gridItem.setStyle("borderStyle", "solid");
    gridItem.colSpan = 2;
    dynamicText = new Text();
    dynamicText.percentWidth = 100;
    dynamicText.text = "A";
    gridItem.addChild(dynamicText);
    gridRow.addChild(gridItem);

  • 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

  • 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

  • Web Application Designer: Column width on analysis_item with BW 7.0

    Hi,
    I'm new to SAP world and I have found a problem I'm not able to solve. I'm working with the Web Application Designer and I want to modify the cell properties (such as cell width) for aligning different queries. In fact, my question are:
    <b>
    1. Is it possible to hard-code/specify column widths of the analysis_item?
    2. The property width of the analysis_item doesn't work, does it?
    </b>
    Thanks for your time and efforts.
    Message was edited by:
            Daniel Rubio

    Hi,
    I have just discovered the capability of modifying columns widths with css properties.
    So if I add to the head section of the html:
    div.prueba2 .urSTTDBdr1
    div.prueba2 .urSTTDBdr
    div.prueba2 .urSTTDBdr2
    And later I put the AnalysisItem between a div class="prueba2" and /div, the columns widths are changed.
    Do you know where can I find all the style properties (such as urSTTDBdr1) and its functions?
    Thanks

  • Interactive Report Column Width adjustable?

    I am using the interactive reports in 3.1.2 and love them. That said, I have a question/problem. I have a column in my report that is essentially comments. It often contains hundreds of bytes of text per row of data. When I use the interactive report I find no where that I can define a default column width or number of report rows to display. So, when I run the report, the column with the comments defaults to a column width of about 25 characters and this causes it to display many html rows for this report row and makes the report very ugly.
    Does anyone know if there is a way to redefine a column in an interactive report to prevent this?

    Scott,
    Using FOP.
    Standard reports PDF can resize columns.
    Interactive report does not. Additionally, the page size does not work the same as the regular reports. Moving between landscape and portrait changes the size of the height and width.
    I assume there are several problems.
    1. The report does not resize horizontally. I will have to create a second report to see if I can duplicate the issue.
    2. The Print page of the report region does not have the same fields as the regular reports. I am not sure why or how to overcome the lack of being able to resize columns, etc.
    3. The functionality on the page does not seem to all work. At least not the same way as the regular reports. Changing paper size and orientation are two examples I have verified.
    4. Can't select a template. How can a different XSL-FO template be used?
    I am going to try and push it to Word.
    Sam
    Edited by: slavanaway on Mar 26, 2009 1:13 PM

  • Crosstab column width in HTML output

    Hi,
    I have problem with column width in a crosstab report with html ouput.
    I can not find a way to control the column width, and the more I try to control this either with word table properties or with xsl attribute, the more messy it gets!
    Now the columns gets superwide and I dont have clue how to control this...
    Ant ideas of how to set the column width in the rtf template fot html output?
    It looks fine with pdf output...
    Br
    Magnus

    Thanks for your tip, but I did not do the trick exactly.
    Can you get help for this in the User guide? I have read it thru without anything...
    Anyway, I couldnt get it right with the Autofit to Window either, I need to set this for specific columns only, but when I do it on the first columns MS Word rearrange the whole table...
    Do you use it on certain columns or the whole table?
    I have to say, I have a quite complex template with several tables within other tables, and this maight mess things up...
    BR
    Magnus

  • Is it possible to have a fixed column width and a URL link?

    I am trying to achieve having a popup link on a column within a SQL report but also have the report column a certain width. I can have either or however not at the same time.
    What I did was created a SQL report, edited a column and gave it a URL redirect (page in application) as normal.
    For the fixed column width, I used:
    <div style="width:250px; height:54px; overflow:hidden" title="#Comments#">#Comments#</div>On Column Formatting / HTML Expression
    And for the popup URL, I used:
    onclick="window.open(this.href,'_blank','resizable=0,scrollbars=0,width=650,height=300,menubar=0,location=0');return false;" title="Comments"On the Column Link / Link Attributes

    Andy thank you for your reply, however I either am not completly understanding or there is a problem elsewhere.
    I have changed to the code to fit the needs of the application as so:
    !http://i41.tinypic.com/2m6mrh4.jpg!
    App ID: 523
    Page: 23
    Item: P23_STATUS_COMMENT
    Column to select: Comments
    Whenever clicking on the link, the following error is given:
    Expecting p_company or wwv_flow_company cookie to contain security group id of application owner.
         Error      ERR-7620 Could not determine workspace for application ().{code}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

Maybe you are looking for

  • Stale data error for a new page (based on an existing native sshr page)

    Without going into too much detail on why I'm doing this, I copied an existing oracle native page, renamed it, and loaded it into the MDS. I navigate to the page by creating an extension on a controller to take me to there on a button click. Also on

  • Problem with apple installing with itunes.msi in windows 7

    At the beggining my computer showed an error with itunes.msi and I tried to fixed the error. Then I tried again to install the itunes but now itunes say that the program cant be installed. Can somebody help me??? Thanks

  • A new Mac in my house, now I can't connect!

    Have been using a Linksys BEFW 1154 wireless router with a Dell desktop as host and an IBM T30 laptop as remote. No problems with e-mail or internet access. My daughter returned from college with her Mac laptop. It automatically detected the wireless

  • No Longer Able To Resize Images (PDF Attachments)

    I recently upgraded to Snow Leopard and am now unable to resize my PDF attachments once they are within an email. Maybe I'm missing something, but in the older version of Mail / Leopard I was able to easily resize my attached PDF's on the fly by simp

  • Webutil_host very slow first time.

    I use a very simple comand WEBUTIL_HOST.NONBLOCKING(COMANDO) where COMANDO is COMANDO := 'CMD /C "'||FILE_NAME||'"' ; and FILE_NAME contains the name of a .xls Excell file. It works fine but first time I execute it it takes more than 5 minutes to ope