PDA

View Full Version : [CLOSED] How to customize a ToolTip title?



vadym.f
Aug 07, 2013, 9:25 PM
Hi,

I'm trying to migrate a piece of 1.x code dealing with customizing the ToolTip title on the client. Please suggest the changes necessary for it to work in 2.x.


<%@ Page Language="C#" %>

<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
if (!X.IsAjaxRequest)
{
DisplayField1.Text = "Some text goes here";
}
}
</script>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title>Ext.Net 2.x</title>
<ext:ResourcePlaceHolder ID="ResourcePlaceHolder1" runat="server" Mode="Script" />
<ext:ResourcePlaceHolder ID="ResourcePlaceHolder2" runat="server" Mode="Style" />
<script type="text/javascript">
var showTooltip = function (tooltip) {
tooltip.body.dom.innerHTML = '<b>' + App.DisplayField1.getValue() + '</b>';
};
</script>
</head>
<body>
<form id="Form1" runat="server">
<ext:ResourceManager ID="ResourceManager1" runat="server">
</ext:ResourceManager>
<ext:Viewport runat="server" Layout="FitLayout">
<Items>
<ext:DisplayField runat="server" ID="DisplayField1">
<ToolTips>
<ext:ToolTip ID="ToolTip1" runat="server">
<Listeners>
<Show Handler="showTooltip(this);" />
</Listeners>
</ext:ToolTip>
</ToolTips>
</ext:DisplayField>
</Items>
</ext:Viewport>
</form>
</body>
</html>

Baidaly
Aug 08, 2013, 12:55 AM
Hello!

You should use BeforeShow:



<%@ Page Language="C#" %>

<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
if (!X.IsAjaxRequest)
{
DisplayField1.Text = "Some text goes here";
}
}
</script>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title>Ext.Net 2.x</title>
<ext:ResourcePlaceHolder ID="ResourcePlaceHolder1" runat="server" Mode="Script" />
<ext:ResourcePlaceHolder ID="ResourcePlaceHolder2" runat="server" Mode="Style" />
<script type="text/javascript">
var showTooltip = function (tooltip) {
tooltip.setTitle("My Tooltip");
tooltip.update('<b>' + App.DisplayField1.getValue() + '</b>');
};
</script>
</head>
<body>
<form id="Form1" runat="server">
<ext:ResourceManager ID="ResourceManager1" runat="server">
</ext:ResourceManager>
<ext:Viewport runat="server" Layout="FitLayout">
<Items>
<ext:DisplayField runat="server" ID="DisplayField1">
<ToolTips>
<ext:ToolTip ID="ToolTip1" runat="server">
<Listeners>

<BeforeShow Fn="showTooltip" />
</Listeners>
</ext:ToolTip>
</ToolTips>
</ext:DisplayField>
</Items>
</ext:Viewport>
</form>
</body>
</html>

vadym.f
Aug 08, 2013, 6:34 PM
Thanks Daulet, it works! Please mark this question as closed.