How to add position and next position $nextpos for option type P (pos)

When we are using positioning for every row inserted we need to keep all of these into consideration.
How to add position and next position $nextpos for option type P (pos)
How to add position and next position $nextpos for option type P (pos)

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);
 
 
This is very straight forward but unless we specify the next position, by default KAS will assign position 0 to the new row, so in our Form View (Add) we will add a query to determine the next position:
 
For the first position we can add:
 
 
$nextpos = 'first';  //This is the default
 
 
For the last position:
 
 
$nextpos = 'last';
 
 
Or we can specify a specific position:
 
 
$count = $connection->new_query("SELECT COUNT($idfield) as next FROM  $dbtable", $kas['debugMode']);
$nextpos = $count->result(0,'next');
 
 
 

Comments

Get a Quote

Get a Quote