Forums

CCv5 Selectively display Delete in a table row

MainsailSoftware 22 Jan, 2015
I have successfully added _DELETE_:Delete to the columns list, the link appears in all rows of the appropriate column, and performs the appropriate row delete when clicked.

I would like to selectively either disable the _DELETE_ on a row by row basis, dependent upon a value in the $row variable as used in the PHP Functions section. I have successfully used PHP Functions to re-format a date for display:

cruise.reg_date:$date = new DateTime($cell); return $date->format('M j');

If I try to do the same with _DELETE_ but it does not work.

I tried something like: _DELETE_:if( some test on $row[val] ) {return $cell;} else {return '';} but this does not seem to work.

What is the appropriate way to selectively display an active delete link in a row and hide it in others?
MainsailSoftware 23 Jan, 2015
Answer
I was able to figure out how to do this based on this post:

http://www.chronoengine.com/forums/posts/f12/t98593/accessing-a-field-in-action-code-with-php.html

I used the following in Front List | Settings | PHP Functions:
cruise.member_number:$mem_id = \GCore\Libs\Request::data("member_number"); return ($cell == $mem_id ? '<a href="index.php/component/chronoconnectivity5/?cont=lists&ccname=CruiseAttendanceList&act=delete&gcb=' . $row['cruise']['id']. '" >remove</a>' : " ");

[attachment=0]CruiseList.PNG[/attachment]

I am still seeing the SQL error bug I reported here

As mentioned there, browser back button redisplays article with "1 items deleted" message and correct DB update and table display.

Jim
This topic is locked and no more replies can be posted.