How to make link on enum type ?

Talk about link fields or link implementations

Moderator: alexandrleonenko

kasumovic
Expert
Expert
Posts: 87
Joined: Sep 7th, '10, 22:38

How to make link on enum type ?

Postby kasumovic » Feb 16th, '11, 19:27

Hello ,

I try to get "liz_mode" what is defined as "enum", to work as "link", is possible to do this ?

here my structure for viewmode :

$liz_array = Array("0"=>"Keine Lizenz","1"=>"Jahres Lizenz","2"=>"Unlimitierte Lizenz") ;

$vm_columns = array(
"kunden_name" =>array("header"=>"Name des Kunden", "header_align"=>"center", "type"=>"link", "width"=>"150px", "align"=>"center", "wrap"=>"nowrap", "text_length"=>"-1", "case"=>"normal",
"sort_by"=>"namen","field_key"=>"customer_id","field_data"=>"kunden_name","href"=>"$script?x_rid={0}&x_mode=edit"),
"strasse" =>array("header"=>"Strasse", "header_align"=>"center", "type"=>"label", "width"=>"80px", "align"=>"center", "wrap"=>"nowrap", "text_length"=>"-1", "case"=>"normal","sort_by"=>""),
"ort" =>array("header"=>"Ort", "header_align"=>"center", "type"=>"label", "width"=>"80px", "align"=>"center", "wrap"=>"nowrap", "text_length"=>"-1", "case"=>"normal","sort_by"=>""),
"activate_date" =>array("header"=>"Aktiv seit", "header_align"=>"center", "type"=>"label", "width"=>"100px", "align"=>"center", "wrap"=>"nowrap", "text_length"=>"-1", "case"=>"normal","sort_by"=>""),
"liz_mode" =>array("header"=>"Lizenz Art", "header_align"=>"center", "type"=>"enum","source"=>$liz_array, "width"=>"100px", "align"=>"center", "wrap"=>"nowrap", "text_length"=>"-1", "case"=>"normal","sort_by"=>""),
"client_count" =>array("header"=>"Anzahl der Clients", "header_align"=>"center", "type"=>"label", "width"=>"50", "align"=>"center", "wrap"=>"nowrap", "text_length"=>"-1", "case"=>"normal","sort_by"=>""),
"days_left" =>array("header"=>"Laufzeit", "header_align"=>"center", "type"=>"label", "width"=>"50px", "align"=>"center", "wrap"=>"nowrap", "text_length"=>"-1", "case"=>"normal","sort_by"=>"")
);

administrator
Site Admin
Site Admin
Posts: 6010
Joined: Jan 7th, '09, 23:18
Contact:

Re: How to make link on enum type ?

Postby administrator » Feb 17th, '11, 08:49

How do you want to see them in View Mode? As a list of links, separated with commas?
Use CONCAT() function for this in SELECT for View MODE

You may also use "on_item_created"=>"" to change a performance of the data in cell.

kasumovic
Expert
Expert
Posts: 87
Joined: Sep 7th, '10, 22:38

Re: How to make link on enum type ?

Postby kasumovic » Feb 17th, '11, 10:09

I have value liz_mode , what can have value :
0 - No Licence
1 - Licence for 1 Year
2 - Unlimited Licence

I will instead value 0..2 in ViewMode to show TEXT like below described, for this i have define field with "type"=>"enum" , and i got this result what i need. But ....

if i click on them i will that they beheave like "type"=>"link" i will that they do some action based on values on this row.


I know that i can assign this TEXT in SQL statement direct, but i would rather use some buil-in options if this is possible.

Maybe you can put in next release something like this : if some Keywords for link are populated then MAKE link on this field with specified href and his values

something like :

...."field_key"=>"customer_id","field_data"=>"kunden_name","href"=>"$script?x_rid={0}&x_mode=edit")

administrator
Site Admin
Site Admin
Posts: 6010
Joined: Jan 7th, '09, 23:18
Contact:

Re: How to make link on enum type ?

Postby administrator » Feb 17th, '11, 18:34

Generally, you don't need "enum" type. you need a link, so why don't use a "link" fields?

1. Define in SQL:
CASE
WHEN = '0' THEN 'No License'
WHEN = '1' THEN 'License for 1 Year'
ELSE 'Unlimited License'
END as my_field,

2. Define my_field as a "link" fields and use all link's features here.


Return to “Field type: "link"”