Giter VIP home page Giter VIP logo

Comments (4)

wasabismile avatar wasabismile commented on May 24, 2024 1

I have also encountered this issue. I resolved it by adding the following code in aggrid.js. Hope this helps.

onGridSizeChanged: this.auto_size_columns ? (params) => params.api.sizeColumnsToFit() : undefined,

from nicegui.

vickorian avatar vickorian commented on May 24, 2024

@falkoschindler

So something like this is part of what inspired me to create #2822 since i was having so much trouble controlling the size of the grid. Rows would stick with original window size, they wouldn't flex correctly, etc. until i dropped a lot of the tailwind-css elements, went directly to style with hard pixel values, and passed " 'resizeable':True" explicitly in defaultColDef of ui.aggrid.

I attempted to expand the container size and have AgGrid match container dimensions but had to drop that after a while and do like you did and resize the table directly.

I'm working on a client project right now with nicegui, but when i get to a stopping point i was planning on investigating anyways since i'll be needing nicegui for future work.

from nicegui.

falkoschindler avatar falkoschindler commented on May 24, 2024

Nice, @wasabismile!

We can use this workaround by passing the "onGridSizeChange" event handler to the options dictionary:

with ui.card().style('width: 500px') as card:
    ui.aggrid({
        'columnDefs': [{'field': 'name'}],
        'rowData': [{'name': 'Alice'}],
        ':onGridSizeChanged': '(params) => params.api.sizeColumnsToFit()',
    })
ui.checkbox('Wide', on_change=lambda e: card.style('width: 1000px' if e.value else 'width: 500px'))

from nicegui.

falkoschindler avatar falkoschindler commented on May 24, 2024

I managed to integrate this solution into aggrid.js, so we can finally resolve this issue. 🚀

from nicegui.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.