При перетаскивании раздела компонента вы можете проверить дочерние элементы firstCol и secondCol, используя dom. Если число равно 2 (в ваших условиях дано), отмените операцию удаления (может быть сделано с помощью сортируемого / перетаскиваемого плагина).
Редактировать 1: // С добавленным вами кодом плункера
$('.component-container').sortable({
connectWith: '.component-container', // Add this
cursor: 'move',
items: ".component-section",
placeholder: 'ui-state-highlight',
start: function(e, ui) {
ui.placeholder.width(ui.item.find('.component-section').width());
ui.placeholder.height(ui.item.find('.component-section').height());
ui.placeholder.addClass(ui.item.attr("class"));
}
});
});
Из html удалите класс .component-container
из текущей позиции и добавьте его к элементам firstCol и secondCol
<div id="fila" class="row center expandir " style="text-align: center;"> - removed component-container from here
<div class="col-md-6 col-xs-12 component-container" id="firstCol"> - added component-container here
<div class="col-md-6 col-xs-12 component-container" id="secondCol"> - added component-container here