Page 1 of 1

Disable edit link in table list

Posted: Sat Jun 29, 2013 6:36 pm
by acutri

v9.2

I would like to disable the edit link for rows that satisfy a condition


Re: Disable edit link in table list

Posted: Sun Jun 30, 2013 11:36 pm
by acutri

my solution:

function ListOptions_Rendered() {

	// Example: 
	if ($this-><DBFIELD>->CurrentValue == <MYVALUE>) { 
		$this->ListOptions->Items["edit"]->Body = "";                
	} 
}                   

thank !!


Re: Disable edit link in table list

Posted: Tue Jul 02, 2013 2:39 pm
by cduperier

Hi,

I have the same problem. I want to hide the edit button when status = "valide"

This code don't work :

if ($this->status->ViewValue == "valide") {
$this->ListOptions->Items["edit"]->Body = "";
}

Re: Disable edit link in table list

Posted: Wed Jul 03, 2013 10:40 am
by danielc

If you put the code into ListOptions_Rendered server event in List Page, it is OK.

Use var_dump($x) to dump your variable to check.


Re: Disable edit link in table list

Posted: Sat Jan 11, 2014 7:24 pm
by Petr

Hi, when I use this working fine, but remove icon is shifted to left.
It`s possible disable this button without this shift or replace to other button?
Regards

Vlastimil


Re: Disable edit link in table list

Posted: Mon Jan 13, 2014 1:45 pm
by danielc

You need to replace the link rather than empty:
//your condition {
$this->ListOptions->Items["edit"]->Body = "<div><a href='javascript:void(0);'><img ...></a></div>" ; // add your image
// }


Re: Disable edit link in table list

Posted: Tue Jan 14, 2014 3:12 am
by Petr

Thanks


Re: Disable edit link in table list

Posted: Thu Jan 16, 2014 11:46 pm
by eudosia

acutri wrote:
my solution:

function ListOptions_Rendered() {

	// Example: 
	if ($this-><DBFIELD>->CurrentValue == <MYVALUE>) { 
		$this->ListOptions->Items["edit"]->Body = "";        
   
	} 
}                   

thank !!

Hello. I am in the list page.
I try to use this statement : $this-><DBFIELD>->CurrentValue
I need It to put in a link to open a custom page like <a href="test.php?id=\"".$this->id->CurrentValue."\">
but the id value is missing. I have put this code into ListOptions_Rendered event.
Do where I'm wrong ?
Thanks.
Max


Re: Disable edit link in table list

Posted: Fri Jan 17, 2014 11:04 am
by danielc

eudosia wrote:
$this->id->CurrentValue

If you put this into ListOptions_Rendered server event, there will have value (if id is your ID field)

eudosia wrote:
<a href="test.php?id=\"".$this->id->CurrentValue."\">

Also, just a quick glance, your syntax for href need to correct assume this is what you need to put into body of edit link:
"<a href=\"test.php?id=" . $this->id->CurrentValue . "\"></a>";

Anyway, can you post your complete code so that it is easy for discussion.


Re: Disable edit link in table list - solved

Posted: Fri Jan 17, 2014 4:15 pm
by eudosia

Thanks so much danielc.
My syntax was wrong...so the link was truncated.....but I fallen in error thanks to the phpmaker editor syntax highlight that tell me my syntax was right.
Now I have correct:
function ListOptions_Rendered() {
// Example:
$this->ListOptions->Items["stampa"]->CssStyle="text-align:center;";
$this->ListOptions->Items["stampa"]->Body = "<a href=\"test.php?id=" . $this->id->CurrentValue . "\" class=\"btn btn-small ewRowLink ewDetailList\">Stampa</a>";


}
but in this case the syntax here $this->ListOptions->Items["stampa"]->Body = "<a href=\"test.php?id=" . $this->id->CurrentValue . "\" class=\"btn btn-small ewRowLink ewDetailList\">Stampa</a>";
appears not correct in the phpmaker10 editor.
THanks so much to point me the mistake.
Max.


Re: Disable edit link in table list

Posted: Fri Jan 17, 2014 5:03 pm
by SmithCOLE

Hello..
Actually i have some problem with disable edit.Please give me some idea so that i can easily do my work in PHP.


Re: Disable edit link in table list

Posted: Fri Jan 17, 2014 6:07 pm
by mobhar

@SmithCOLE,

In which part you have the problem?


Re: Disable edit link in table list

Posted: Fri Sep 02, 2016 9:07 pm
by Tonygo

Just to clarify for anyone else, this worked for me in the List page - place under table-specific.
I have a column called Status which has either active or inactive in it and I wanted to hide the edit icon if inactive:

// ListOptions Rendered event
function ListOptions_Rendered() {
if ($this->Status->CurrentValue == "inactive") {
$this->ListOptions->Items["edit"]->Body = "False";
}
}