Disable edit link in table list
v9.2
I would like to disable the edit link for rows that satisfy a condition
v9.2
I would like to disable the edit link for rows that satisfy a condition
my solution:
function ListOptions_Rendered() {
// Example:
if ($this-><DBFIELD>->CurrentValue == <MYVALUE>) {
$this->ListOptions->Items["edit"]->Body = "";
}
}
thank !!
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 = "";
}
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.
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
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
// }
Thanks
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
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.
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.
Hello..
Actually i have some problem with disable edit.Please give me some idea so that i can easily do my work in PHP.
@SmithCOLE,
In which part you have the problem?
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";
}
}