Author Topic: autoRow height issue.  (Read 5305 times)

ralph1996

  • Pro Ultimate
  • Jr. Member
  • *
  • Posts: 80
    • View Profile
autoRow height issue.
« on: September 01, 2020, 10:13:38 pm »
In versions prior to 5.0 you could use virtualX and virtualY independently.  With the removal of those options all rendering is done virtually. In some cases we may have a very wide grid with many columns.  Often the columns scrolled off the display to the right initially will have a large amount of content requiring the cell height to be much taller then other cells.  What is undesirable is that when you scroll horizontally the row heights constantly adjust as you scroll which is pretty difficult to keep track of the rows you may be trying to view as they jump around based on the content of each row.  This is the same behavior prior to 5.0 if you set both virtualX and virtualY to true.

Prior to 5.0 we set virtualX to false so that the rows displayed would be fully rendered and the max cell height in the full row would be used for the row height.  This allowed for smooth horizontal scrolling.

I do not see any way to replicate that in version 5.0.

We are upgrading from 3.4 and doing each version individually so we can verify the updates are complete. If this functionality is available in a later release We can ignore for now and wait until we get to that version.

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6309
    • View Profile
Re: autoRow height issue.
« Reply #1 on: September 01, 2020, 10:29:54 pm »
There are no virtualX, virtualY options since v5.

However auto height can be disabled and fixed height can be assigned to rows with pq_ht property of rowData

https://paramquery.com/pro/demos/row_heights

ralph1996

  • Pro Ultimate
  • Jr. Member
  • *
  • Posts: 80
    • View Profile
Re: autoRow height issue.
« Reply #2 on: September 02, 2020, 01:01:27 am »
This is not a very good solution.  IN the previous versions if you used virtualX = false then the entire row would be rendered which then allowed you to use autoHeight because it would automatically set each row to the height of the tallest cell in the row.  That way you would not have any data clipped out of the cells.

With your solution we have to set the row height explicitly for each row.  This would be fine if we could determine the height of the tallest cell in the row.  However since not all cells are rendered (in a row that extends beyond the viewport) there is no way to determine this.  So we would just have to guess based on the length of the data and/or line breaks in the cells.  Or is there a way we can get the rendered height of all cells in a row without them actually being rendered?

If this is not possible, this is a very unfortunate digression from earlier versions (Pre 5.0).  If you have data in the row where the cell heights might vary a fair bit, it makes scrolling horizontally very disruptive.  As an example, if all of the data in the left most columns of the rows displayed are single line height, you might get 20+ rows on the screen for example.  But if you scroll to the right and each of those rows has a cell that is 5 lines tall.  All of a sudden the 20 rows switches to 4 rows and it is very hard to track which specific row you were interested in as it may not even be in the view anymore.  Even using fixed columns on the left does not help because often the row you are looking for jumps out of the view and then you have to start scrolling vertically trying to find it. 

This is very problematic in our application.  The VirtualX = false was a perfect solution for us.

I understand if you have thousands of columns that it is impractical to render them all at once. But in many cases we have a limited number of columns (maybe 20 or 30) which easily supports rendering the full row for those rows in the vertical viewport. I think it is very important that you at least have an option to have virtualX = false available.

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6309
    • View Profile
Re: autoRow height issue.
« Reply #3 on: September 04, 2020, 11:52:02 am »
Horizontal scrolling in v5+ does not feel disruptive as it used to be in v5- with virtualX: true

Please experience it in one of the demos with horizontal scrolling.

https://paramquery.com/pro/demos/import-xlsx
« Last Edit: September 04, 2020, 11:54:14 am by paramvir »

ralph1996

  • Pro Ultimate
  • Jr. Member
  • *
  • Posts: 80
    • View Profile
Re: autoRow height issue.
« Reply #4 on: September 04, 2020, 09:56:42 pm »
Your example is not indicative of the issue.  The below code (modified from the unlimited columns demo) shows the issue more clearly.

Run this code and then scroll to the right.  As you get to column 11 row 8 will automatically expand in height then scroll more to column 20 and you will see row 4 expand in height.  Now if you scroll down from there so that row 8 is visible you will see row 8 shrinks because column 11 is no longer in view.

With a small amount of multiple line rows this is not too bad, but when you have multiple columns in which many of the rows have different height data, this becomes very annoying as column heights continually jump around as you scroll.

Code: [Select]
$(function () {
        var rowsNum = 100,
            colsNum = 10002,
            data = [];

        for (var i = 0; i < rowsNum; i++) {
            var row = [];
            for (var j = 0; j < colsNum; j++) {

if( i == 7 && j == 11)
{
row[j] = 'This is very long text that will wrap.  You can see that the row height jumps as you horizontally scroll to this cell.';
}
else if( i == 4 && j == 20)
{
row[j] = 'This is very long text that will wrap.  You can see that the row height jumps as you horizontally scroll to this cell.';
}
else
                row[j] = Math.round(Math.random() * 10000);
            }

            data[i] = row;
        }

        // header
        var colModel = [],
            headerCol = {};
        for (var i = 0, j = 0; j < colsNum; i++, j++) {
            headerCol = {
                title: "Test col " + j,
                collapsible: {},
                //width: 240,
                align: "center"
            }
            headerCol.colModel = [{
                title: "SubCol " + j++,
                width: 120,
                align: "center"
            }, {
                title: "SubCol " + j++,
                width: 120,
                align: "center"
            }, {
                title: "SubCol " + j,
                width: 160,
                //minWidth: 120,
                align: "center"
            }];
            colModel[i] = headerCol;
        }

        //colModel[0].colModel[1].hidden = true;
        //colModel[2].colModel[0].hidden = true;

        var obj = {           
            hoverMode: 'cell',
            showTitle: false,
            toolbar:{
                items: [
                    {
                        type: 'button',
                        label: 'Toggle collapsed',
                        listener: function(){
                            var grid = this;
                            grid.Columns().alter(function(){
                                grid.option('colModel').forEach(function(column){
                                    column.collapsible && (column.collapsible.on = !column.collapsible.on);
                                })                 
                            })
                        }       
                    }
                ]
            },
            minWidth: 400,
            numberCell: {width: 40},
            editable: false,
            resizable: true,           
            hwrap: false,
            colModel: colModel,
            dataModel: { data: data }
        };

        pq.grid("#grid_infinite", obj);
    });

The biggest issue is you may be scrolling to see a particular row of data, but as you scroll that row may actually jump out of the view because other rows data expands.  So it is very hard to find the data you want to see.

I really think that you need to restore the virtualX option at least.  Or if there is a way for us to calculate the height of all the cells in a row even if not rendered we could use that to set the fixed row height of each row.

This may not be a common problem for applications that are intended to be more spreadsheet like where the contents of cells is relatively small.  But in our case we often have cells that will contain multiple lines of data in multiple columns.

ralph1996

  • Pro Ultimate
  • Jr. Member
  • *
  • Posts: 80
    • View Profile
Re: autoRow height issue.
« Reply #5 on: September 14, 2020, 07:22:37 pm »
HI,  I was hoping you would be able to suggest some sort of workaround for this issue.  Is there a way that we can calculate the cell heights of ALL cells in a row?

The behavior of rows changing height as you scroll can make the grid very difficult to use in these circumstances and it is an issue that could be resolved in earlier versions of ParamQuery.

Thank You

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6309
    • View Profile
Re: autoRow height issue.
« Reply #6 on: September 15, 2020, 07:46:00 pm »
Only workaround currently is to forgo horizontal scroll and use width: 'flex' to calculate cell heights of all cells in a row.

Scrolling in v5+ is designed such that there is no abrupt change in height of rows while horizontal scrolling which used to be the case in older versions and hence there used to be virtualX option for it.

Still if you are facing problems with current setup, then I would look into reintroducing virtualX in v7.5
« Last Edit: September 15, 2020, 08:29:35 pm by paramvir »

ralph1996

  • Pro Ultimate
  • Jr. Member
  • *
  • Posts: 80
    • View Profile
Re: autoRow height issue.
« Reply #7 on: September 16, 2020, 01:30:04 am »
Thanks for your reply.  Using width flex on all columns in the grid would not work for us at all.  Specifically because some of the data in the cells is long enough that the columns would be ridiculously wide based on the content.  My guess is that if we did that we would also run into the issue of column widths adjusting on the fly as the grid was scrolled horizontally.  Effectively the same issue as with horizontal scrolling. 

Since in our case and probably in most cases, data is typically setup to store the actual iterated data in rows with some defined number of columns holding the data for each row, the horizontal case is probably the most affected by this.  However it s also conceivable that the iterated data would be handled in columns as well so VirtualY may be needed for others.

We would definitely like this reinstated in a future release as soon as possible.  We will need to evaluate if this is a big enough issue that will require us to hold off on upgrading to the latest release in our production code.  We purposely purchased the upgrade in order to get our code current, but if we cannot do that it may be wasted until this is resolved.

Thank you for your consideration.  If you would like to see a demonstration of the issues I can supply you with a test account and instructions in our application so you can witness it yourself.

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6309
    • View Profile
Re: autoRow height issue.
« Reply #8 on: September 16, 2020, 04:11:29 pm »
I meant by applying width: 'flex' to the grid only.

In v5+, height of rows doesn't change abruptly while the viewport is being scrolled horizontally, but height is changed gradually when there is a pause in scrolling.

It would be great if you can share a test case where row heights are changed abruptly while horizontal scrolling is in progress.

ralph1996

  • Pro Ultimate
  • Jr. Member
  • *
  • Posts: 80
    • View Profile
Re: autoRow height issue.
« Reply #9 on: September 16, 2020, 08:48:01 pm »
I understand that the row heights do not change while actively dragging and moving the scroll button.  However when you stop dragging the rows are resized or if you click on the scroll bar to perform the scroll it happens.  I included example code in a previous reply that demonstrates this using one of your demos. The only change in the demo was adjusting the data in a couple of cells to allow the issue to display. 

I have created a video showing the effect in our application that you can see here:

https://www.dropbox.com/s/zy5qum3rxpbpwls/DocketTrak%C2%AE%20-%20Google%20Chrome%202020-09-16%2008-06-45.mp4?dl=0

As you can see I highlight cell contents in a fixed column of the row.  Then scroll to the right and the row I was interested in (highlighted) shifts off the screen.  Also the highlight is lost

I then scroll back and of course the row heights stay the same. Finally I scroll vertically up and down which now causes the rows to adjust again.

In general we feel the auto adjustment of the row heights makes for unexpected behavior and causes the user frustration.  The previous ability to use VirtualX = False removed this issue. Of course it does come at the expense of potentially fewer rows being visible on the screen when the taller cells are not in view, but we believe that is preferable.

Thank You


paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6309
    • View Profile
Re: autoRow height issue.
« Reply #10 on: September 17, 2020, 03:45:13 pm »
Thanks for the video, I'm looking into adding virtualX: false support.

ralph1996

  • Pro Ultimate
  • Jr. Member
  • *
  • Posts: 80
    • View Profile
Re: autoRow height issue.
« Reply #11 on: September 17, 2020, 07:26:43 pm »
Thank you.  Much appreciated.

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6309
    • View Profile
Re: autoRow height issue.
« Reply #12 on: September 23, 2020, 12:48:19 pm »
Please use the recent v7.5.0 for non-virtual rendering support.