saseow
Posts: 744
|
| Posted: 09/24/2008, 1:57 PM |
|
I have an editable grid with a listbox that must show the abbreviation of a description. The table of the abbreviations also has the full description.
I would like to achieve something like a mouseover event so when a row is selected, something shows the full description. I know a tag or popup is not possible (I think) but maybe there is another way.
Is it possible to have say a label that will show the full description when a specific row is selected? Anyone done anything like this before?
Thanks,
Trevor
|
 |
 |
mentecky
Posts: 321
|
| Posted: 09/24/2008, 2:41 PM |
|
I have used DHTML Tip Message which can be found at http://www.dynamicdrive.com/dynamicindex5/popinfo.htm
It's not terribly difficult to implement. First DL the code at the link above. I put the files in a sub folder named tipmessage.
On the page you want to implement it, go to HTML and add the following in the HEAD block:
<script language="JavaScript1.2" src="tipmessage/main.js" type="text/javascript"></script>
Then I made sure the fields I wanted to use in the popup were included in my grid's query, even though I wasn't going to display them in the grid.
Now the fun part. I added a LABEL to my grid and named it DetailLabel where I wanted my link to appear. I set the content to HTML. What we have to do now is build the HTML for the link and the popup. So in DetailLabel Before Show I added code to create the popup.
Here's my code to popup contact notes when you hover over the link:
// Get the unique ID for the link
$call_id = $call_status_types_calls_c->ds->f("call_id");
// Get the notes field and make it HTML safe
$contact_notes = htmlspecialchars(str_replace('"', '\"', str_replace("\r\n", "<br>",
$call_status_types_calls_c->ds->f("contact_notes"))), ENT_QUOTES);
$popup = "";
if ($contact_notes != "")
{
$popup .= "<b>Contact:</b><br>$contact_notes";
}
else
{
$popup = "None available";
}
// Add the unique key to the current query string
$querystring = CCGetQueryString("QueryString","");
$querystring = CCAddParam($querystring, "call_id", $call_id);
// Build the link HTML
$text = "<A href='call_maint_all.php?$querystring' onMouseOver='stm([";
$text .= '"Notes","'.$popup;
$text .= '"'."],Style[2])' onmouseout='htm()'>Details</A>";
// Set the label control's value to our new HTML code
$call_status_types_calls_c->DetailLabel->SetValue($text);
Obviously, you'll need to change the variable names and such, but it should be a start.
Rick
_________________
http://www.ccselite.com |
 |
 |
saseow
Posts: 744
|
| Posted: 09/24/2008, 3:29 PM |
|
Thanks so much Rick! I will try this tomorrow morning and let you know.
Kindest regards,
Trevor
|
 |
 |
saseow
Posts: 744
|
| Posted: 09/24/2008, 4:51 PM |
|
Hi Rick,
Thanks for this info and I will keep it for future reference.
The problem I have is that the abbreviation fields is a listbox and the grid is an editable grid. I don't think there is any way to create a link in the listbox unfortunately.
Thank you so much for your efforts though!
With kindest regards,
Trevor
|
 |
 |
mentecky
Posts: 321
|
| Posted: 09/24/2008, 7:13 PM |
|
Trevor,
In your listbox data source click on SELECT. In the select list at the bottom enter something like CONCAT_WS('-', abbrev_field, desc_field) and give it an alias name like "full_name". Then change your Text Column to the new alias field. This will show the abbreviation next to the full description.
Hope that helps,
Rick
_________________
http://www.ccselite.com |
 |
 |
saseow
Posts: 744
|
| Posted: 09/24/2008, 8:07 PM |
|
Hi Rick,
Once again, thank you so much. This is the best solution possible. I thought of adding a legend but seeing that the list can change, that would have been a hassle.
Kindest regards,
Trevor
|
 |
 |
mentecky
Posts: 321
|
| Posted: 09/24/2008, 8:52 PM |
|
Trevor,
Glad to help!
Rick
_________________
http://www.ccselite.com |
 |
 |
|