I am creating dashboard application with Gridster: https://github.com/ManifestWebDesign/angular-gridster
I would like to save my layout to database using JSON. What I do know, is that I store charts array to database and fetch it. Is it possible to store widget col,row and size to specific widget so I could then give the size-x and size-y with angular style {{chart.xsize}}. When creating widget I could then assign default size values and save only after user has resized or dragged widget. Or is this completely wrong way to do this? How else I could store the widget sizes and positions to database?
I have ng-repeat for my widgets like this:
<div ng-if="chart.type === settings.types.LINEAR_GAUGE">
<div class="panel c8y" gridster-item size-x="2" size-y="1">
<div class="panel-heading">
<h3 class="panel-title">{{chart.title}}</h3>
<button class="btn btn-danger pull-right btn-xs" ng-click="onClickDelete($index)"><span class="glyphicon glyphicon-remove"/></button>
</div>
<div class="panel-body">
<c8y-linear-gauge dp="chart.dp" measurement="chart.data[0].measurement"/>
</div>
</div>
</div>