3.2.0

column header height bug

I seem to have stumbled into a bug that appears when you specify column header height in em rather than px. It's kind of difficult to describe but very easy to see.

In example basic.htm from the distribition package make the following change:
// obj.setColumnHeaderHeight("20px");
    obj.setColumnHeaderHeight("1.5em");

Now make the window smaller so that vertical scroll bar appears, scroll down and then scroll up using the keyboard. You'll see that instead of floating below the column headers the highlighted row kinda slides underneath it and becomes partially or fully obscured by it ( depending on the column header height you set). It looks like if you set it in em, its height is either not taken into account when calculating the position of hightlighted row, or is regarded to be zero.

Can you reproduce this? Can this be fixed?

Many thanks,
Sergei
May 31,
Alex,

Since apparently you're back to reading this forum again, I decided to remind you of this problem (above) ... I realize that 1.0 is not your priority anymore, but you surely don't want to carry this bug over to 2.0

Cheers,
Sergei
July 8,
My fault - apparently that's a bug in setSelectionIndex method (grid.js).

Should change:

var top, padding = parseInt(data.element().currentStyle.paddingTop);


to something like

var top, padding = data.element().firstChild.offsetTop;


Here is corrected code for this method (lib/controls/grid.js):

var setSelectionIndex = obj.setSelectionIndex;

    obj.setSelectionIndex = function(index){

        setSelectionIndex.call(this, index);
        this.setSelectionValues([index]);

        var row = this.getTemplate("row", index);
        var data = this.getTemplate("layout").getContent("data");
        var left = this.getTemplate("layout").getContent("left");
        var scrollbars = this.getTemplate("layout").getContent("scrollbars");

        try {
            var top, padding = data.element().firstChild.offsetTop;
            if (data.element().scrollTop > row.element().offsetTop - padding) {
                top = row.element().offsetTop  - padding;
                left.element().scrollTop = top;
                data.element().scrollTop = top;
                scrollbars.element().scrollTop = top;
            }

            if (data.element().offsetHeight + data.element().scrollTop <
                row.element().offsetTop + row.element().offsetHeight ) {
                top = row.element().offsetTop + row.element().offsetHeight - data.element().offsetHeight;
                left.element().scrollTop = top;
                data.element().scrollTop = top;
                scrollbars.element().scrollTop = top;
            }
        }
        catch(error){
            // ignore errors
        }
    };


So it looks like I should plan 1.0.2 as well. Even if its not much fun - I am going to maintain version 1 for at least 12 months after 2.0 is released. So if you see more bugs - please let me know.
Alex (ActiveWidgets)
July 8,
Alex,

Many thanks - haven't tried yet, but sure your remedy will work.
As for more bugs - not quite a bug, but an issue that needed clarification. It was raised great number of times, by myself and other folks before and after me. Will bring it to the top of the forum in a moment...

Cheers,

Sergei
Sergei
July 8,

This topic is archived.

See also:


Back to support forum