I need two things today.
- Create a link for every row in the grid. Each link will transfer the page to a new component and use the search keys automatically.
- Create a hover or mouseover label for the links.
Step by step guide below.
- Create an HTML object (MYHTMLOBJECT) with the following value.
<a href=%Bind(:3) title="%Bind(:2)" target="_blank"> %Bind(:1) </a>
- Add an HTML area field to a grid. Use a derived record field.
We will refer to it as MYDERIVEDRECORD.DESCR254_MIXED.
- Add the following code to Page Activate.
Each piece has an explanation.
Local Rowset &RS; Local Record &Rec; Local number &i; Local string &Key1Value, &Final_String, &LinkName, &AdditionalParameterString, &Hover_Text, &TransURL; /* Get the grid rowset */ &RS = GetLevel0()(1).GetRowset(Scroll.MYGRIDRECORD); /* Loop through grid rowset */ For &i = 1 To &RS.ActiveRowCount &Rec = &RS(&i).MYGRIDRECORD; /* Set the link label */ &LinkName = "Link: " | &Rec.ATTACHUSERFILE.Value; /* Assign the key values - hardcoded for this example */ &Key1Value = (enter employee ID here); /* Create parameter string */ &AdditionalParameterString = "&EMPLID=" | &Key1Value; /* Create the URL */ &TransURL = GenerateComponentPortalURL(%Portal, %Node, MenuName.MYMENU, %Market, Component.MYCOMPONENT, Page.MYPAGE, "U") | &AdditionalParameterString; /* Create the mouseover link */ &Hover_Text = "Hover for " | &LinkName; &Hover_Text = ""; /* Generate hyperlink and assign the value to the HTML area field on the grid */ &Final_String = GetHTMLText(HTML.MYHTMLOBJECT, &LinkName, &Hover_Text, &TransURL); &RS(&i).MYDERIVEDRECORD.DESCR254_MIXED.Value = &Final_String; End-For;
And here's the result.
No comments:
Post a Comment