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.

AutocolumnSize problem in secondary Tab

See original GitHub issue

Hello, I also have this problem. Columns do not display correctly when in a secondary tab.

image

But when you change any of the filters then the columns show fine.

image

I noticed that when you load the grid and there is no data to display then the columns resize and look good. The problem is when there is data the first time it loads.

image

Code:

` private autoSize;

    constructor(container: JQuery) {
        super(container);
    }

    protected createSlickGrid(): Slick.Grid {
        let grid = super.createSlickGrid();
        this.autoSize = new Slick.AutoColumnSize(true);
        grid.registerPlugin(this.autoSize);

        return grid;
    }

    protected markupReady() {
        super.markupReady();
        if (this.autoSize != null) {
            this.autoSize.resizeAllColumns();
        }
    }`

Thank you!

_Originally posted by @ArsenioInojosa in https://github.com/volkanceylan/Serenity/issues/2737#issuecomment-660420243_

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
ArsenioInojosacommented, Jul 24, 2020

Thank you very much @JohnRanger for your invaluable collaboration.

I’m going to study the slick.autocolumnsize.js file to determine what the differences are when running it on the main and secondary tabs. So far I have discovered a couple of interesting things, when I finish I will tell you the results.

Update:

The problem is that when the grid is not visible to the user then “var headerWidth = getElementWidth (el);” The function resizeAllColumns () returns 0.

Very thankful!

1reaction
JohnRangercommented, Jul 23, 2020

Ok - the first test shows that the plugin is loaded and works on the correct grid - because the double-clicked separator resizes the left column. This is also one of the functions of the plugin.

So I still think that we are dealing here with a timing issue at the point in time when this.autoSize.resizeAllColumns() is executed.

Lets do a simple test:

within the markupReady() method, put the autoSize.resizeAllColumns() call within a setTimeout code block and give it a 5 second delay (5000) - like this:

protected markupReady() {
    super.markupReady();
    if (this.autoSize != null) {
        var _mythis = this;  // *** Store "this" in order to use it within the setTimeout callback ***
        setTimeout(function(){
             alert("hello here"); 
             _mythis.autoSize.resizeAllColumns();
            
        }, 5000);
    }
}`

Expected result: After 5 seconds after the grid shows up, an alert dialog shows “hello here” and after confirming the dialog, the columns of the grid should be auto-resized.

Please let me know the result.

Regards,

John

Read more comments on GitHub >

github_iconTop Results From Across the Web

AutocolumnSize problem with Tabs · Issue #2737 · serenity ...
Everything is working fine unless you display an autosized grid in a (second) tab. In the code : function resizeAllColumns() { ... elHeaders....
Read more >
stretchH='all' and tableheader missing in vue frameworks ...
Issue : My handsontable is on the second tab. so whenever I clicked that tab, table header and stretchH=“all” doesn't show/work ...
Read more >
Strange rendering error - Issues
I am having the following issue with Handsontable, for some reason it renders this gap between the first and second column, ...
Read more >
JavaScript Data Grid: Column Sizing
All columns can be resized by dragging the top right portion of the column. Enable Sizing. Turn column resizing on for the grid...
Read more >
Auto Column Size Problems
Dear DevExpress Team, we are using the Auto Column Size Feature in our Grid. When its activated for the first time during runtime...
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