我创建了一些网格程序,现在想以编程方式对它们进行排序。例如,在以下情况下使用 data-displayorder
属性。
<div data-displayorder="7" id="GridsterContent01" class="panel panel-filled panel-responsive js-reportTable gs-w" data-col="1" data-row="31" data-sizex="20" data-sizey="5" style="display: block;">
<span class="gs-resize-handle gs-resize-handle-both"></span>
</div>
<div data-displayorder="4" id="GridsterContent-2" class="panel panel-filled panel-responsive js-reportTable gs-w" data-col="1" data-row="31" data-sizex="20" data-sizey="5" style="display: block;">
<span class="gs-resize-handle gs-resize-handle-both"></span>
</div>
我尝试使用 jQuery 来做到这一点,但这会影响大小和样式。
var sortPriorirty = $(this).attr('data-displayOrder');
$(this).attr('data-row', sortPriorirty );
是否有API可以在创建后分配gridster
数据行?
最佳答案
尝试在网格之间添加额外的行。
var sortPriorirty = $(this).attr('data-displayOrder');
$(this).attr('data-row', sortPriorirty+5 );
关于javascript - 创建后动态分配 gridster 数据行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52070818/