DWR

addRows should workaround IE's border bug for empty table cells

Details

  • Type: Improvement Improvement
  • Status: Resolved Resolved
  • Priority: Minor Minor
  • Resolution: Fixed
  • Affects Version/s: 1.0, 1.1, 1.1.1, 1.1.2, 1.1.3, 1.1.4, 2.0.rc1, 2.0.rc2, 2.0.rc3, 2.0.rc4, 2.0.rc5, 2.0, 2.0.1, 2.0.2, 2.0.3, 2.0.4, 2.0.5, 3.0.M1
  • Fix Version/s: 3.0.RC1
  • Component/s: Util
  • Description:
    Hide
    Paul Christmann wrote:

    I'm using dwr.utl.addRows to build a table. The data being rendered
    has some blank values in it (the cellFuncs can return ""), resulting
    in a table that has some blank cells: <td></td>

    In Firefox and Safari, these tables render just fine. However, in
    Internet Explorer, the tables render without the cell border - so the
    blank valued cells look bad. The fix that works in all browsers is to
    instead put the non-printable blank space in the cell:
    <td>&nbsp;</td>.

    First, I attempted to adjust my cellFuncs to return "&nbsp;" rather
    than "" where I needed a blank. But then I ran into html escaping - I
    ended up with <td>&amp;nbp;</td>. I can get around this by setting
    the escapeHtml option to false.

    But then I'm left with two problems:
    a) rendering a table without html escaping. I'd prefer the safety of
    the html escaping, as I might have values that need it.
    b) My cellFuncs functions start to get complicated. Right now, they
    generally just return a property of a server object. Now, each of
    those functions will have to test the return value for the server
    property and decide to return something different.

    Would you consider a patch to util.js such that the addRows method
    (actually, the _addRowInner method) would set the innerHTML to "&nbsp"
    if the data is an empty string? I have been playing with such a patch
    locally, and it works as I'd like it to.

    Or is there another way to get this behavior?

    Show
    Paul Christmann wrote: I'm using dwr.utl.addRows to build a table. The data being rendered has some blank values in it (the cellFuncs can return ""), resulting in a table that has some blank cells: <td></td> In Firefox and Safari, these tables render just fine. However, in Internet Explorer, the tables render without the cell border - so the blank valued cells look bad. The fix that works in all browsers is to instead put the non-printable blank space in the cell: <td>&nbsp;</td>. First, I attempted to adjust my cellFuncs to return "&nbsp;" rather than "" where I needed a blank. But then I ran into html escaping - I ended up with <td>&amp;nbp;</td>. I can get around this by setting the escapeHtml option to false. But then I'm left with two problems: a) rendering a table without html escaping. I'd prefer the safety of the html escaping, as I might have values that need it. b) My cellFuncs functions start to get complicated. Right now, they generally just return a property of a server object. Now, each of those functions will have to test the return value for the server property and decide to return something different. Would you consider a patch to util.js such that the addRows method (actually, the _addRowInner method) would set the innerHTML to "&nbsp" if the data is an empty string? I have been playing with such a patch locally, and it works as I'd like it to. Or is there another way to get this behavior?

Activity

People

Dates

  • Created:
    04/Dec/08 12:08 AM
    Updated:
    29/Nov/12 3:24 PM
    Resolved:
    04/Dec/08 12:11 AM