Programatically set width/height of GridItems
See original GitHub issueHey.
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.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:12 (5 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@pxljoy I managed to solve this by triggering
resizeEvent
on gridLayoutsee updated fiddle here
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 😄