$('#items-grid').tableDnD({
onDragClass: "ItemsDragClass",
onDrop: function(table, row) {
- $.post(reorder_url, {'ids': $.tableDnD.serialize()}, function(data){});
+ $.post(reorder_url, {'ids': $.tableDnD.serialize(), 'drop_id':row.id}, function(data){});
}
});
});
if (!isset($request->POST['ids']))
return new IPF_HTTP_Response_NotFound();
+ if (!isset($request->POST['drop_id']))
+ return new IPF_HTTP_Response_NotFound();
+ $drop_id = $request->POST['drop_id'];
+
$lapp = $match[1];
$lmodel = $match[2];
+
foreach (IPF_Project::getInstance()->appList() as $app){
foreach($app->modelList() as $m){
if (strtolower($m)==$lmodel){
$o = new $m();
$ids = split(',',(string)$request->POST['ids']);
- $o->_reorder($ids, $ord_field);
+ $o->_reorder($ids, $ord_field, $drop_id);
return new IPF_HTTP_Response_Json("Ok");
}
}
return null;
}
- public function _reorder($ids, $ord_field){
+ public function _reorder($ids, $ord_field, $drop_id){
$ord = 1;
foreach($ids as $id){
$item = $this->getTable()->find($id);