tiberiuzuld/angular-gridster2

How to change x, y gridsterItem with typescript code

khanhle123 opened this issue · 4 comments

Hi dev teams, i wanna change x,y of gridsterItem when press arrow up or down by keyboard. i try to item.x++ but it not work. Any solutions to resolve it???

first update the item and then call optionsChanged function.
https://stackblitz.com/edit/angular-gridster2-example-iwnhhw?file=src%2Fapp%2Fgrid%2Fgrid.component.ts

item.x = item.x++;
this.options.api.optionsChanged();

Hi @AndeYashwanth, When I set this.options.api.optionsChanged() , it changes the width and height of the other gridsterItem. How to prevent it?

@eapatel Do you have an example?
Before calling options changed, check whether all the width and height of the items that you pass to the gridster are corrent. Maybe they are getting updated somewhere in your code.

Thanks for the reply @AndeYashwanth. I've managed to solve it. Thanks again.