$(document).off('click', '.batch-btn').on('click', '.batch-btn', function()
{
    const $this  = $(this);
    const type   = $this.data('type');
    const dtable = zui.DTable.query($('#backlogList'));
    const checkedList = dtable.$.getChecks();
    if(!checkedList.length) return;

    const postData = new FormData();
    checkedList.forEach((id) => postData.append(type + 'IdList[]', id));

    $.ajaxSubmit({"url": $(this).data('url'), "data": postData});
});

window.onSortEnd = function(from, to)
{
    if(from == undefined || to == undefined) return;

    const link = $.createLink('pi', 'ajaxSortBacklog', 'piID=' + piID + '&from=' + from.id + '&to=' + to.id + '&orderBy=' + orderBy);
    $.ajaxSubmit({"url": link});
}
