When using positioning in a table view, we need to add the option type "p" to the table view but also to the Add Form so it can respect the sequence already created. (not the update form)
$HOME->setOption("ADD BANNER,AGREGAR BANER,AJOUTER BANIER","aside","4","FAPS"); $HOME->setOption("VIEW BANNERS,VER BANERS,VOIR ANIERS","aside","4","VIPLDSE",true);
$nextpos = 'first'; //This is the default
$nextpos = 'last';
$count = $connection->new_query("SELECT COUNT($idfield) as next FROM $dbtable", $kas['debugMode']); $nextpos = $count->result(0,'next');
On the View Table page, by default is the option type P is added, it will automatically add the drag icons to change the row's position, and it will use the variable "pos" as the column name in the database.
If we want to order by a different column we need to add the variable $orderby and of the value is not "pos" it will not show the arrows on each row
$orderby = 'pos';
If we need to order by a different database column and allow the the tabke to modify the position based on a database column that is not "pos", we need to add a variable $posCol, then change the value of $orderby and tell KAS to always show positioning with $showpos
$posCol = 'new_pos'; $orderby = $posCol; $showpos = true;
$posCol = 'new_pos'; if(!isset($ob)){ $orderby = $posCol; $asde = 'DESC'; $showpos = true; }else{ $orderby = $ob; $showpos = false; }
$query = "SELECT * FROM $dbtable %%WHERE%% order by $orderby $asde";