Я пытаюсь построить вложенныйsortable заголовок для строк (Ниже HTML-код). Все отлично работает. Заголовок динамически создается через php, и я могу сортировать. Но сериализовать через toHierarchy вернуть мне неопределенные объекты ([undefined, undefined, undefined]). Есть идеи?NestedSortable, toHierarchy return undefined
<ol class="sortable ui-sortable mjs-nestedSortable-branch mjs-nestedSortable-expanded">
<li style="display: list-item;" class="mjs-nestedSortable-branch mjs-nestedSortable-expanded" data-dbrowid="700">
<div class="rowTitle projectbg ui-sortable-handle" data-dbrowid="700" data-parentrowid="700" data-recordtype="10" data-refrecid="309" data-projid="309">Fonteyn</div>
<ol>
<li style="display: list-item;" class="mjs-nestedSortable-leaf" data-dbrowid="739">
<div class="rowTitle ui-sortable-handle" data-dbrowid="739" data-parentrowid="700" data-recordtype="60" data-refrecid="23" data-projid="309">BIG Szczecin (2) T+S</div>
</li>
<li style="display: list-item;" class="mjs-nestedSortable-leaf" data-dbrowid="824">
<div class="rowTitle ui-sortable-handle" data-dbrowid="824" data-parentrowid="700" data-recordtype="60" data-refrecid="2" data-projid="309">GROM (4) J+G+P+R</div>
</li>
<li style="display: list-item;" class="mjs-nestedSortable-leaf" data-dbrowid="782">
<div class="rowTitle ui-sortable-handle" data-dbrowid="782" data-parentrowid="700" data-recordtype="80" data-refrecid="1" data-projid="309">Bartek + Krzysztof - engineering</div>
</li>
<li style="display: list-item;" class="mjs-nestedSortable-leaf" data-dbrowid="834">
<div class="rowTitle ui-sortable-handle" data-dbrowid="834" data-parentrowid="700" data-recordtype="60" data-refrecid="23" data-projid="309">BIG Szczecin (2) T+S</div>
</li>
</ol>
</li>
<li style="display: list-item;" class="mjs-nestedSortable-branch mjs-nestedSortable-expanded" data-dbrowid="203">
<div class="rowTitle vrij ui-sortable-handle" data-parentrowid="203" data-recordtype="20" data-refrecid="299" data-projid="299">VRIJ – WOLNE</div>
<ol>
<li style="display: list-item;" class="mjs-nestedSortable-leaf" data-dbrowid="413">
<div class="rowTitle ui-sortable-handle" data-dbrowid="413" data-parentrowid="203" data-recordtype="60" data-refrecid="27" data-projid="299">Robert (4) R+M+A+J</div>
</li>
<li style="display: list-item;" class="mjs-nestedSortable-leaf" data-dbrowid="769">
<div class="rowTitle ui-sortable-handle" data-dbrowid="769" data-parentrowid="203" data-recordtype="70" data-refrecid="22" data-projid="299">Waldek</div>
</li>
<li style="display: list-item;" class="mjs-nestedSortable-leaf" data-dbrowid="448">
<div class="rowTitle ui-sortable-handle" data-dbrowid="448" data-parentrowid="203" data-recordtype="60" data-refrecid="20" data-projid="299">BIG Police (2) A+D</div>
</li>
<li style="display: list-item;" class="mjs-nestedSortable-leaf" data-dbrowid="831">
<div class="rowTitle ui-sortable-handle" data-dbrowid="831" data-parentrowid="203" data-recordtype="70" data-refrecid="12" data-projid="299">André</div>
</li>
</ol>
</li>
<li style="display: list-item;" class="mjs-nestedSortable-branch mjs-nestedSortable-expanded" data-dbrowid="204">
<div class="rowTitle wensen ui-sortable-handle" data-parentrowid="204" data-recordtype="30" data-refrecid="300" data-projid="300">WENSEN – ŻYCZENIA</div>
<ol>
<li style="display: list-item;" class="mjs-nestedSortable-leaf" data-dbrowid="466">
<div class="rowTitle ui-sortable-handle" data-dbrowid="466" data-parentrowid="204" data-recordtype="70" data-refrecid="17" data-projid="300">Moni(cz)ka</div>
</li>
<li style="display: list-item;" class="mjs-nestedSortable-leaf" data-dbrowid="518">
<div class="rowTitle ui-sortable-handle" data-dbrowid="518" data-parentrowid="204" data-recordtype="70" data-refrecid="35" data-projid="300">Gosia</div>
</li>
<li style="display: list-item;" class="mjs-nestedSortable-leaf" data-dbrowid="615">
<div class="rowTitle ui-sortable-handle" data-dbrowid="615" data-parentrowid="204" data-recordtype="70" data-refrecid="42" data-projid="300">Janek G.</div>
</li>
<li style="display: list-item;" class="mjs-nestedSortable-leaf" data-dbrowid="617">
<div class="rowTitle ui-sortable-handle" data-dbrowid="617" data-parentrowid="204" data-recordtype="70" data-refrecid="8" data-projid="300">Jan</div>
</li>
<li style="display: list-item;" class="mjs-nestedSortable-leaf" data-dbrowid="742">
<div class="rowTitle ui-sortable-handle" data-dbrowid="742" data-parentrowid="204" data-recordtype="70" data-refrecid="15" data-projid="300">Laura</div>
</li>
<li style="display: list-item;" class="mjs-nestedSortable-leaf" data-dbrowid="838">
<div class="rowTitle ui-sortable-handle" data-dbrowid="838" data-parentrowid="204" data-recordtype="70" data-refrecid="41" data-projid="300">Kamil</div>
</li>
</ol>
</li>
$('ol.sortable').nestedSortable({
forcePlaceholderSize: true,
handle: 'div',
helper: 'clone',
items: 'li',
opacity: .6,
placeholder: 'placeholder',
revert: 250,
tabSize: 25,
tolerance: 'pointer',
toleranceElement: '> div',
maxLevels: 2,
isTree: true,
expandOnHover: 700,
startCollapsed: false,
disableParentChange: true,
relocate: function(){
var array = $(this).nestedSortable('toHierarchy', {startDepthCount: 0});
console.log(sortArray);
}
});
С точки зрения стиля кода вы можете упростить свой пример. Например, атрибут стиля на странице HTML является плохой привычкой, и я думаю, что бесполезно понимать вашу проблему. –