angular-gridster2 icon indicating copy to clipboard operation
angular-gridster2 copied to clipboard

How to change x, y gridsterItem with typescript code

Open khanhle123 opened this issue 1 year ago • 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???

khanhle123 avatar Feb 27 '23 04:02 khanhle123

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();

AndeYashwanth avatar Mar 06 '23 08:03 AndeYashwanth

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

eapatel avatar Jul 13 '23 00:07 eapatel

@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.

AndeYashwanth avatar Jul 14 '23 13:07 AndeYashwanth

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

eapatel avatar Aug 08 '23 01:08 eapatel