This is a migrated thread and some comments may be shown as answers.

tooltip and ragrid column reordering

4 Answers 99 Views
ToolTip
This is a migrated thread and some comments may be shown as answers.
lnu
Top achievements
Rank 1
lnu asked on 19 Nov 2009, 08:26 AM
Hello,

I use a radtooltipmanager to replace the browser standard tooltip. It works well except in one case: I have a radgrid with reoredcolumnsonclient=true. If I swap two columns, the tooltip still displays the previous column value and not the new one.
I also did the test with Qtip and Jquery.tooltip, and the results is the same.

Is there a trick?

Best regards,

Laurent

4 Answers, 1 is accepted

Sort by
0
Svetlina Anati
Telerik team
answered on 24 Nov 2009, 09:18 AM
Hello lnu,

What you want to achieve out of the box is in fact a little bit more  complicated than it seems. Let me first explain how the automatioc tooltipifying works. When the page loads and the RadToolTipManager is created with automatic tooltipifying turned on, it iterates through all teh controls with title/tooltip set, creates RadToolTips with the corresponding text and removes the standard tooltips (to avoid having 2 tooltips at the same time). What actually happens in your case is that when you reorder the columns on the client you should retooltipify them. However, if you call explicitly the function which tooltipifies, it will not work as expected because the standard tooltips have already been removed. What I can suggest in your case is to use serverside reordering and update both the grid and the tooltip manager with AJAX, for example as shown below:

<asp:ScriptManager ID="ScriptManager1" runat="server" />
<asp:UpdatePanel ID="pnl" runat="server">
    <ContentTemplate>
        <telerik:RadGrid AutoGenerateColumns="false" ID="RadGrid1" runat="server" OnItemDataBound="RadGrid1_ItemDataBound"
            GridLines="None">
            <MasterTableView CommandItemDisplay="None" TableLayout="Auto">
                <Columns>
                    <telerik:GridBoundColumn CurrentFilterFunction="NoFilter" DataField="FirstColumn"
                        HeaderText="FirstColumn" HeaderTooltip="FirstColumn">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn CurrentFilterFunction="NoFilter" DataField="SecondColumn"
                        HeaderText="SecondColumn" HeaderTooltip="SecondColumn">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn CurrentFilterFunction="NoFilter" DataField="ThirdColumn"
                        HeaderText="ThirdColumn" HeaderTooltip="ThirdColumn">
                    </telerik:GridBoundColumn>
                    <telerik:GridTemplateColumn HeaderText="Template Column">
                        <ItemTemplate>
                            <asp:HyperLink ID="target1" runat="server" Text="Show first tooltip"></asp:HyperLink>
                            <br />
                            <br />
                            <asp:HyperLink ID="target2" runat="server" Text="Show second tooltip"></asp:HyperLink>
                        </ItemTemplate>
                    </telerik:GridTemplateColumn>
                </Columns>
            </MasterTableView>
            <ClientSettings AllowColumnsReorder="true">
            </ClientSettings>
        </telerik:RadGrid>
        <telerik:RadToolTipManager ID="mng1" runat="server" AutoTooltipify="true" Width="200">
        </telerik:RadToolTipManager>
    </ContentTemplate>
</asp:UpdatePanel>

This worked fine on my side. I understand that this solution has some disadvantages but having in mind how the controls work and also using all this functionality directly out of the box makes this setup complicated and this is teh best solution I can suggest.

All the best,
Svetlina
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
lnu
Top achievements
Rank 1
answered on 24 Nov 2009, 09:36 AM
Hello,

thank you for the response. Do you plan to make it work out of the box in the future or not?

best regards,

Laurent
0
lnu
Top achievements
Rank 1
answered on 24 Nov 2009, 11:06 AM
I've discovered it only happens with gridboundcolumn. If I use templatecolumn with a Label in the ItemTemplate, I can reorder everything client side without any problems. It seems the bug is due to the way the columns are reordered client side and not due to the tooltip. Imho.
I dig a bit and the problem is:
- when the column are reordered/swapped, the content of the TD is moved from one column to the other. But the tooltip event is binded to the TD element and not on the content (in the case of a gridboundcolumn). So any events binded to a column will not follow this column when reorderd.

Best regards,

Laurent
0
Svetlina Anati
Telerik team
answered on 27 Nov 2009, 08:37 AM
Hello lnu,

Straight to your questions:

1) As I already explained, this is how the controls work and thus it will not be fixed but other approach should be used for this scenario.

2) Indeed, the solution you have found will work. This is expected since the controls in a template persist their ID while the grid's embedded one change them on reordering.

I am glad you found a solution for your case, it is a reliable one and I recommend to stick to it.

Best wishes,
Svetlina
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
ToolTip
Asked by
lnu
Top achievements
Rank 1
Answers by
Svetlina Anati
Telerik team
lnu
Top achievements
Rank 1
Share this question
or