[英]How do I add a RadToolTip to a JQuery dynamically generated table cell text
How do I add a Radtooltip to a text that appears in a dynamically created table cell using JQuery. 如何使用JQuery将Radtooltip添加到动态创建的表格单元格中的文本中。 The Tooltip popup should show the data from the cell along with a hyperlink.
工具提示弹出窗口应显示单元格中的数据以及超链接。 This is for a table displaying issues and the tooltip is suppose to display a link taking use to a resolution page.
这是用于显示问题的表格,工具提示用于显示用于解析页面的链接。
function GenerateProblemResoultionLinks() {
// Open up the landing page for addressing the problem.
function problemLink_Click() {
// Get the problem data from the row.
var $self = $telerik.$(this);
var oProblemData = JSON.parse(
$self.attr("data-Problem")
);
// Add the original message to the problem data.
oProblemData["problemText"] = $self
.text()
.trim();
// Convert the object back to JSON and encode it for transport.
var strProblemDataArgument = encodeURIComponent(
JSON.stringify(oProblemData) );
var strURL =
"problemresolutionpage.aspx?problemData=" +
strProblemDataArgument;
window.open(strURL, "_blank");
}
// Set up the delegated event handler.
$telerik
.$(".PROBLEMDETAILS> tbody")
.on("click", ".problemLink", problemLink_Click);
}
I resolved my problem by modifying my code as follows: 我通过修改我的代码解决了我的问题,如下所示:
function GenerateProblemResoultionLinks() {
function problemLink_Click() {
// Get the problem data from the row.
var $self = $telerik.$(this);
var oProblemData = JSON.parse(
$self.attr("data-integrationProblem")
);
// Add the original message to the problem data.
oProblemData["problemText"] = $self
.text()
.trim();
if (oProblemData){
// Generate problem soltuion tooltip for each problem type. Needs to stay within the scope of the onclick.
switch(oProblemData.type){
case "ProblemType1":
var IDForSolution1=oProblemData.data["layoutIDT"];
var IDForSolution2 = oProblemData.data["keywordTableIDT"];
var Soltuion1Link="<a href=pageforsoltuion1.aspx?item="+ IDForSolution1 +" target=\"_blank\">UpdateItem</a>";
var Solution2Link="<a href=pageforsolution2.aspx?record="+ IDForSolution2 +" target=\"_blank\">Add New Record</a>";
var toolTipTMsg ="A new record may be added to the record table <br/> OR<br/> item can be updated in the item table."
var radToolTip = $find("<%= RadToolTip1.ClientID %>");
radToolTip.set_targetControl(this);
radToolTip.set_content("<p>" +toolTipTMsg +"</p>-------------------</br>" + Soltuion1Link +"<br/>"+ Soltuion2Link);
radToolTip.show();
break;
default:
break;
}
}
}
// Set up the delegated event handler.
$telerik
.$(".IMPORTEXPORTDETAILS > tbody")
.on("click", ".problemLink", problemLink_Click);
}
and I added the following as well: 我还添加了以下内容:
<telerik:RadToolTip RenderMode="Lightweight" ID="RadToolTip1" runat="server" Title="Problem Solution(s)" IsClientID="true" Callout="false" RelativeTo="Element" Position="MiddleRight" ShowEvent="FromCode" Height="220" Width="300" HideEvent="LeaveToolTip">
</telerik:RadToolTip>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.