• Column widths are not applied consistently

    By Peter LaComb 2 decades ago

    Essentially, when extendLastColumn is true, all columns except the last should have the width applied. When false, All columns except the extra should have the width applied:



    To correct, I've changed the block at line 731 from:



    if(col.width && i < this.columns.length-1){

                    th.style.width = col.width;<br/>
                }<br/>
                <br/>
    

    To:


                <br/>
    

    if (col.width) {

    if ((this.extendLastColumn) &amp;&amp; (i &lt; this.columns.length-1)) {<br/>
        th.style.width = col.renderWidth;<br/>
    } else if (!this.extendLastColumn) {<br/>
        th.style.width = col.renderWidth;<br/>
    }<br/>
    

    }





    A similar change occurs at 1227:



    from:



    if(x < this.columns.length - 1)td.style.width = this.columns[x].width;



    to:



    if (this.columns[x].width) {

    if ((this.extendLastColumn) &amp;&amp; (x &lt; this.columns.length-1)) {<br/>
        td.style.width = this.columns[x].renderWidth;<br/>
    } else if (!this.extendLastColumn) {<br/>
        td.style.width = this.columns[x].renderWidth;<br/>
    }<br/>
    

    }





    and again at 1264:



    from:



    else if(x < this.columns.length - 1) td.style.width = this.columns[x].width;



    to:



    else {

    if (this.columns[x].width) {<br/>
        if ((this.extendLastColumn) &amp;&amp; (x &lt; this.columns.length-1)) {<br/>
            td.style.width = this.columns[x].renderWidth;<br/>
        } else if (!this.extendLastColumn) {<br/>
            td.style.width = this.columns[x].renderWidth;<br/>
        }<br/>
    }<br/>
    

    }



    and at 1291: (maybe we could find a way to not write this same code so many times?



    from:



    if(x < this.columns.length - 1){

                        td.style.width = this.columns[x].width;<br/>
                    }<br/>
                    <br/>
                    <br/>
    

    to:



    if (this.columns[x].width) {

    if ((this.extendLastColumn) &amp;&amp; (x &lt; this.columns.length-1)) {<br/>
        td.style.width = this.columns[x].renderWidth;<br/>
    } else if (!this.extendLastColumn) {<br/>
        td.style.width = this.columns[x].renderWidth;<br/>
    }<br/>
    

    }

    • Additional Info...

      By Peter LaComb 2 decades ago

      I failed to fully separate this from a change I'd like to suggest.



      Where you see .renderWidth it should read .width



      This is because I calculate the width in EM units as follows:



      this.columns[i-offSet].renderWidth = ((this.columns[i-offSet].width - 0)/ 8) + "em";



      This seems to give widths more like those in the client.

      • getRow problem without extendLastColumn=false

        By Paul S Withers 2 decades ago

        With the fix I was finding the view correctly built with the correct column widths if extendLastColumn=true. But if extendLastColumn=false, the view design built fine, but was being shunted to the left of the screen as soon as the first line of data was being added. I tracked this down to the getRow function, with the line 1327-1332:


            if(!this.extendLastColumn){<br/>
                var td = tr.appendChild(document.createElement(&quot;td&quot;));<br/>
                td.className = &quot;dataCell&quot;;<br/>
                td.innerHTML = &quot;&amp;nbsp;&quot;;<br/>
                td.style.width = '50%';<br/>
            }<br/>
        



        td.style.width for the appended column was causing problems with 50%, overriding the column widths set for the other columns and creating a final blank column that took up most of the screen. Setting it to '1px' (or other non-relative value) seemed to solve the problem. For info, this was viewing on IE 7.