-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
on resizestop - data-gs-height not updated ? #577
Comments
We are running into the same problems. It seems the "snapping to the grid" action happens after the resizestop event. |
I found a solution, but I don't like it ! I calculated the height by looking into the source of gridstack.js var grid = $(this).data('gridstack');
var height = (1.5 * grid.opts.cellHeight - 1) But it would be greate if this probleme could be corrected. |
This is updated when |
Can't you create another event that is triggered after you change the elements sizes ? (like the 'change' event, one for resize and another one for move) |
change event on data-gs-height and data-gs-width should be solve the problem, just make sure to call the event only once if both are changed |
Hey people, Does anyone know if there is a fix, work-around or anything planned to resolve this issue please? I'm working on a ASP.NET (Core) MVC dashboard project, calling C# controller code to write "x,y" (dragstop) & "width,height" (resizestop) settings back to an SQL table to persist the dashboard state. The code works fine, but the values returned to the methods are not updated until after the events (as stated here). Unfortunately, the work-around mentioned here (calculating from opts) only works for height, since "opts" does not contain a 'cellWidth' or 'x','y'. Any help greatly appreciated!!! 😉 |
Hi, you can calculate the grid item size from css height/width. |
Hey Poohyhu,
Thanks for getting back to me.
I guessed there might be a way.
Do you have an example that will point me in the right direction?
"A Google link speaks a thousand words"
Can this method also be used to get the x and y from css?
I'm guessing not.
Thanks
:D
|
Hi, var gridOptions = itemHeight = Math.round(cssHeight / gridOptions.cellHeight); |
Hey, thanks for the example Poohyhu. I understand what you mean now, and I've implemented something similar. Unfortunately, the height calculation needs some work (will post if I get it working) as the value is out (bit high) and this work-around doesn't address the x,y issue; it's a pretty cool package otherwise 👍. I'm hoping you manage to resolve this in a future release of GridStack? Thanks again ---- update ---- Have found |
Hi, not so nice, but workable solution for dragstop and resizestop you can get any live data, just wait for a few millisecond 😃 otherwise, for x and y you can use the jQuery offset().top and offset().left to calculate the right grid x y regards |
You're pretty awesome! Nice work, thanks 😄 The complete work-around (which works for now) is below (for others):
...and example of called function code, which hooks into ASP.NET / MVC / C# code (located in site.js):
|
welcome, but you don't need the children thing. the event.target is the selected object regards |
I'm rendering charts (using high-charts) into affected I had to dig about a bit to locate the id, and |
This will be fixed in |
Fixed on the |
This will get you the updated values. |
@pootpootman In what context would you do that? Using the event is the best way to get the size of the resized widget. |
Hi I'm having an issue regarding this gsresizestop. |
Hi !
I am not able to get the current height of the element when I'm in the
.on('resizestop')
event.When I make :
element.getAttribute('data-gs-height');
It gives me always the old value, not the new one.Here is my code :
https://jsfiddle.net/Karam/wzzm2oua/6/
Thank you for your help.
The text was updated successfully, but these errors were encountered: