PDA

View Full Version : [CLOSED] row tooltip not working



JCarlosF
Feb 15, 2013, 5:07 PM
I saw the example GridPanel Row Tooltip and apply it, but this does not work, the code is as follows:





<ext:XScript ID="XScript1" runat="server">
var onBeforeShow = function (toolTip, grid) {
var view = grid.getView(),
record = view.getRecord(toolTip.triggerElement),
data = Ext.encode(record.data);
toolTip.update(data);
};
</script>
</ext:XScript>






<ext:GridPanel ID="GridPanelMatch" runat="server" Layout="Fit" Header="false" Region="Center" Height="500" >
<View>
<ext:GridView runat="server" StripeRows="true" TrackOver="true" >
<GetRowClass Fn="ColorFilas">
</GetRowClass>
</ext:GridView>
</View>

<SelectionModel>
<ext:CheckboxSelectionModel ID="CheckboxSelectionModelSolicitudes" runat="server" Mode="Multi">
<Listeners>
<BeforeSelect Fn="NoSelec"></BeforeSelect>
<Select Fn="SeleccionarFila"></Select>
</Listeners>
</ext:CheckboxSelectionModel>
</SelectionModel>


<ColumnModel ID="ColumnModel1" runat="server" Cls="columnModel">
<Columns>
<ext:Column ID="ColCandidato" runat ="server" Resizable="false" header="Clave" DataIndex="Candidato" Width ="70" AutoHeight="true" />
<ext:Column ID="ColNombre" runat ="server" Resizable="false" header="Nombre" DataIndex="Nombre" Width ="170" AutoHeight="true" />
<ext:ComponentColumn ID="ComponentColumnComentarios" runat="server" Editor="true" DataIndex="Coment" Width="200"
Text="Comentarios">
<Component>
<ext:TextField ID="TextFieldComentarios" runat="server" ><ToolTips><ext:ToolTip runat="server" Html="Comentarios al seleccionar un candidato"></ext:ToolTip></ToolTips></ext:TextField>
</Component>
<Listeners>
<Bind Fn="ConfigComent">
</Bind>
</Listeners>
</ext:ComponentColumn>

<ext:CommandColumn ID="CommandColumnAcciones" runat="server" Width="90" Text="Acciones" MenuDisabled="false" Hideable="false" DataIndex="Acciones" Resizable="false" >
<Commands>
<ext:GridCommand Icon="Accept" CommandName="Seleccionar" Hidden="False" ToolTip-Text="Seleccionar" />
</Commands>
<DirectEvents>
<Command OnEvent ="OnCommandSolicitudes" />
</DirectEvents>
<PrepareToolbar Fn="prepareToolbar" />
</ext:CommandColumn>
</Columns>
</ColumnModel>

<Store>
<ext:Store ID="StoreMatchSol" runat="server" PageSize="16" >
<Model>
<ext:Model ID="ModelMatchSol" runat="server" IDProperty="Candidato">
<Fields>
<ext:ModelField Name="Candidato" />
<ext:ModelField Name="Nombre" />
</Fields>
</ext:Model>
</Model>

</ext:Store>
</Store>
</ext:GridPanel>

<ext:ToolTip ID="ToolTip5"
runat="server"
Target="={#{GridPanelMatch}.getView().mainBody}"
Delegate="={#{GridPanelMatch}.getView().itemSelector}"
TrackMouse="true" >
<Listeners>
<Show Handler="onBeforeShow(this, #{GridPanelMatch});" />
</Listeners>
</ext:ToolTip>




thanks!

Daniil
Feb 15, 2013, 5:27 PM
Hi @jCarlosF,

Please try to replace

Target="={#{GridPanelMatch}.getView().mainBody}"
wtih

Target="={#{GridPanelMatch}.getView().el}"

JCarlosF
Feb 15, 2013, 5:53 PM
I already did that, but does not work,

what else can be?

Currently I have version 2.0,

does not is that?


thanks!

Baidaly
Feb 16, 2013, 1:23 AM
Hello!

Try the following:



<%@ 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)
{
this.Store1.DataSource = this.Data;
this.Store1.DataBind();
}
}

private object[] Data
{
get
{
return new object[]
{
new object[] { "3m Co", 71.72, 0.02, 0.03, "9/1 12:00am" },
new object[] { "Alcoa Inc", 29.01, 0.42, 1.47, "9/1 12:00am" },
new object[] { "Altria Group Inc", 83.81, 0.28, 0.34, "9/1 12:00am" },
new object[] { "American Express Company", 52.55, 0.01, 0.02, "9/1 12:00am" },
new object[] { "American International Group, Inc.", 64.13, 0.31, 0.49, "9/1 12:00am" },
new object[] { "AT&T Inc.", 31.61, -0.48, -1.54, "9/1 12:00am" }
};
}
}
</script>

<!DOCTYPE html>

<html>
<head runat="server">
<title>Ext.NET Examples</title>

<style>
.x-grid-row-over .x-grid-cell-inner {
font-weight : bold;
}
</style>

<ext:XScript ID="XScript1" runat="server">
<script>
var onBeforeShow = function (toolTip, grid) {
var view = grid.getView(),
record = view.getRecord(toolTip.triggerElement),
data = Ext.encode(record.data);
toolTip.update(data);
};
</script>
</ext:XScript>
</head>
<body>
<ext:ResourceManager runat="server" SourceFormatting="True" />

<ext:GridPanel
ID="GridPanel1"
runat="server"
Title="Array Grid"
Width="600"
Height="350">
<Store>
<ext:Store ID="Store1" runat="server">
<Model>
<ext:Model runat="server">
<Fields>
<ext:ModelField Name="company" />
<ext:ModelField Name="price" Type="Float" />
<ext:ModelField Name="change" Type="Float" />
<ext:ModelField Name="pctChange" Type="Float" />
<ext:ModelField Name="lastChange" Type="Date" DateFormat="M/d hh:mmtt" />
</Fields>
</ext:Model>
</Model>
</ext:Store>
</Store>
<ColumnModel>
<Columns>
<ext:Column runat="server" Text="Company" DataIndex="company" Flex="1" />
<ext:Column runat="server" Text="Price" DataIndex="price">
</ext:Column>
<ext:Column runat="server" Text="Change" DataIndex="change">
</ext:Column>
<ext:Column runat="server" Text="Change" DataIndex="pctChange">
</ext:Column>
<ext:DateColumn runat="server" Text="Last Updated" DataIndex="lastChange" />
</Columns>
</ColumnModel>
<SelectionModel>
<ext:RowSelectionModel runat="server" />
</SelectionModel>
<ToolTips>
<ext:ToolTip ID="ToolTip5"
runat="server"
Delegate="tr.x-grid-row"
TrackMouse="true" >
<Listeners>
<Show Handler="onBeforeShow(this, #{GridPanel1});" />
</Listeners>
</ext:ToolTip>
</ToolTips>
</ext:GridPanel>
</body>
</html>

Daniil
Feb 16, 2013, 5:10 AM
Currently I have version 2.0,


2.0 is a bit out-of-date. Please update to v2.1.1 or from the SVN trunk.

JCarlosF
Feb 18, 2013, 3:20 PM
Excellent! Thanks Baidaly, it worked perfectly


this is an important part of the solution:




<ToolTips>
<ext:ToolTip ID="ToolTip5"
runat="server"
Delegate="tr.x-grid-row"
TrackMouse="true" >
<Listeners>
<Show Handler="onBeforeShow(this, #{GridPanel1});" />
</Listeners>
</ext:ToolTip>
</ToolTips>

JCarlosF
Feb 18, 2013, 3:22 PM
2.0 is a bit out-of-date. Please update to v2.1.1 or from the SVN trunk.



Ok Daniil, I will do that, thanks!