question-mark

Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

resizeCanvas() does not take into account the preHeader height

See original GitHub issue

Issue Description

I have created a grid with the wollowing options:

                        autoEdit: false,
                        editorCellNavOnLRKeys: true,
                        enableAutoResize: true,
                        enableCellNavigation: true,
                        enableColumnReorder: false,
                        enableGrouping: false,
                        frozenColumn: 0,
                        createPreHeaderPanel: true,
                        editable: true,
                        explicitInitialization: true,
                        preHeaderPanelHeight: 25,
                        showPreHeaderPanel: true,
                        autoResize: {
                        containerId: $('#MyGrid')

On calling resizeCanavas(), e.g.

                         $(window).resize(function () {
                             grid.resizeCanvas();
                         });

the height of the grid is reduced by 25px.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6

github_iconTop GitHub Comments

1reaction
xavier-90commented, May 21, 2020

I have done further tests and found that I was actually “barking at the wrong tree”. The issue is with the resizer: If setting the resizer bottom padding to 0 then the grid is rendered with a bottom padding of 20px (the default). I have logged this as #504

1reaction
xavier-90commented, May 17, 2020

I had to make a minor mod for it to work correctly in my scenario (inside a flex grow column height 100%): The viewportTopH does no need to include the preHeaderHeight.

Also made a change to take into account the showPreHeaderPanel value.

function resizeCanvas() {
      if (!initialized) { return; }
      paneTopH = 0;
      paneBottomH = 0;
      viewportTopH = 0;
      viewportBottomH = 0;
+      var preHeaderHeight = (options.createPreHeaderPanel && options.showPreHeaderPanel) ? (options.preHeaderPanelHeight || 0) : 0;

  //-- ... code removed for brevity --//

      // The top pane includes the top panel and the header row
+      paneTopH += topPanelH + preHeaderHeight + headerRowH + footerRowH;

      if (hasFrozenColumns() && options.autoHeight) {
        paneTopH += scrollbarDimensions.height;
      }

      // The top viewport does not contain the top panel or header row
      viewportTopH = paneTopH - topPanelH - headerRowH - footerRowH;

Read more comments on GitHub >

github_iconTop Results From Across the Web

Canvas sometimes does not resize to width and height
I tried to resize my canvas in Javascript below: 'use strict'; ( ...
Read more >
Preheader Text Not Working - Litmus
I am running into another strange issue. This is the first time I have ever seen this, but for some reason the preheader...
Read more >
What is an Email Preheader? (+ How it Boosts Open Rates)
Email preheaders, sometimes called preview text or a "Johnson box," is a small line of text after the subject line of an email....
Read more >
4 Email Preheader Best Practices - Mailchimp
Email preheaders are one of the first things your readers see, so getting them right is important. Follow these tips to get more...
Read more >
Using Preview & Preheader Text in Pardot to Encourage Opens
Preview and preheader text can make or break your email open rates ... that is not visible in the email body to only...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found