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.

Programatically set width/height of GridItems

See original GitHub issue

Hey.

For example, can we set the GridItem’s width + 1 and it work as if we were resizing? I have the code:

...
data () {
    return {
      layout: [
            {"x":0,"y":0,"w":4,"h":2,"i":"0"},
  	    {"x":2,"y":0,"w":2,"h":4,"i":"1"},
  	    {"x":4,"y":0,"w":2,"h":5,"i":"2"},
  	    {"x":6,"y":0,"w":2,"h":3,"i":"3"},
  	    {"x":8,"y":0,"w":2,"h":3,"i":"4"}
      ],
      cols: 12
    }
  },
methods: {
    enlarge: function(index) {
      this.layout = this.layout.map((g, i)=>{
        if(i === index) {
          //Increase the width of the grid item by 1 at the index given
          return {...g, w: g.w + 1}
        } else {
          return g
        }
      });
    }
  }
...

When I increase it, it works the first time, but if I click the button again it keeps increasing and wont push any other grid items accordingly.

https://gyazo.com/d895617d4aee1b06edf4df3d61d34b29

Issue Analytics

  • State:open
  • Created 6 years ago
  • Reactions:1
  • Comments:12 (5 by maintainers)

github_iconTop GitHub Comments

12reactions
SergeyKhvalcommented, Oct 19, 2017

@pxljoy I managed to solve this by triggering resizeEvent on gridLayout

see updated fiddle here

1reaction
pxljoycommented, Sep 1, 2017

https://gyazo.com/d22462a6c5b64640c1eb95b31ba5875f

This is similar to my use case. I need to increase the width and minimum width of the component on demand.

If you have any other suggestions tell me 😄

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to set width and height of cell item in GridView ...
I am trying to set a dynamic width and height of my GridView's items, this is my code: class GridAdapter extends BaseAdapter {...
Read more >
Programmatically Setting Grid Height Size - IT Programming
Dear All, I have problem with setting grid (datagrid, flexgrid) height size. I have to do trial and error to fix the height...
Read more >
Lay Out Apps Programmatically - MATLAB & Simulink
Resize and reposition the UI components by setting the RowHeight and ColumnWidth properties of the grid layout manager. Set the height of the...
Read more >
How do I programmatically set the height on an SfGrid?
We have inbuilt Height property for Grid. So, based on this scenario, we suggest you to use property binding for the Grid's Height...
Read more >
grid-template-rows - CSS: Cascading Style Sheets | MDN
As a minimum represents the largest minimum size of items in that track (specified by the min-width / min-height of the items).
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