[CLOSED] Doesn't work ToolTips for ComboBox Items

  1. #1

    [CLOSED] Doesn't work ToolTips for ComboBox Items

    Why Doesn't work ToolTips for ComboBox Items?
         public class ComboBoxEasyExt : Ext.Net.ComboBox, IDisposable     {         private bool _ItemsToolTipsEnable = false;         public bool ItemsToolTipsEnable { get { return _ItemsToolTipsEnable; } set { _ItemsToolTipsEnable = value; } }          private string _DisplayField = "Name";         public string DisplayField { get { return _DisplayField; } set { _DisplayField = value; } }          private string _ValueField = "Id";         public string ValueField { get { return _ValueField; } set { _ValueField = value; } }          public string DataTypeName { get; set; }          public string DataSourceTypeName { get; set; }          private string _DataSourceMethod = "GetList";         public string DataSourceMethod { get { return _DataSourceMethod; } set { _DataSourceMethod = value; } }          public string EmptyText { get; set; }          public string EmptyValue { get; set; }          private void LoadData()         {             if (!Ext.Net.X.IsAjaxRequest)             {                 base.Items.Clear();                 base.Mode = Ext.Net.DataLoadMode.Single;                 if (!String.IsNullOrEmpty(this.DataSourceTypeName) && !String.IsNullOrEmpty(this.DataTypeName))                 {                     JiPSoftware.Framework.Web.SearchParameters search_params = new JiPSoftware.Framework.Web.SearchParameters();                     search_params.DsTypeName = this.DataSourceTypeName;                     search_params.DsMethod = this.DataSourceMethod;                     List data = JiPSoftware.Framework.Web.SearchTools.LoadList(search_params).Cast().ToList();                     bool IsExistValue = (!String.IsNullOrEmpty(this.ValueField) && !object.ReferenceEquals(JiPSoftware.Framework.Helpers.GetTypeFromString(this.DataTypeName).GetProperty(this.ValueField), null));                     bool IsExistText = (!String.IsNullOrEmpty(this.DisplayField) && !object.ReferenceEquals(JiPSoftware.Framework.Helpers.GetTypeFromString(this.DataTypeName).GetProperty(this.DisplayField), null));                     bool IsExistEmpty = (!String.IsNullOrEmpty(this.EmptyValue) || !String.IsNullOrEmpty(this.EmptyText));                     if (IsExistEmpty)                     {                         base.Items.Add(                             new Ext.Net.ListItem(                                 (!String.IsNullOrEmpty(this.EmptyText) ? this.EmptyText : string.Empty),                                 (!String.IsNullOrEmpty(this.EmptyValue) ? this.EmptyValue : string.Empty)));                     }                     foreach (object o in data)                     {                         base.Items.Add(                             new Ext.Net.ListItem(                                 (IsExistText ? o.GetType().GetProperty(this.DisplayField).GetValue(o, null).ToString() : string.Empty),                                 (IsExistValue ? o.GetType().GetProperty(this.ValueField).GetValue(o, null).ToString() : string.Empty)));                     }                     if (IsExistEmpty)                     {                         base.Value = (!String.IsNullOrEmpty(this.EmptyValue) ? this.EmptyValue : string.Empty);                     }                     if (this.AutoWidth)                     {                         base.AutoSize();                     }                 }             }         }         protected override void OnDataBinding(System.EventArgs e)         {             LoadData();             base.OnDataBinding(e);             _hasJustBound = true;         }          protected override void OnPreRender(System.EventArgs e)         {             if (!_hasJustBound)             {                 DataBind();             }             if (this.ItemsToolTipsEnable)             {                 this.GenerateToolTips();             }             base.OnPreRender(e);         }          private void GenerateToolTips()         {             base.ToolTips.Clear();             Ext.Net.ToolTip tt = new Ext.Net.ToolTip();             tt.Listeners.Show.Handler = "var record = " + this.ClientID + ".findRecord(" + this.ClientID + ".valueField, " + this.ClientID + ".getValue()); this.body.update(record ? 'Value: ' + record.get(" + this.ClientID + ".valueField) + '
     Text: ' + record.get(" + this.ID + ".displayField) : 'Empty');";             base.ToolTips.Add(tt);         }      }
    Last edited by Daniil; Jul 12, 2011 at 2:09 PM. Reason: [CLOSED]
  2. #2
    Hi,

    Please see how items tooltip should look.

    Example

    <%@ Page Language="C#" %>
     
    <!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 runat="server">
        <title>Ext.Net Example</title> 
    </head>
    <body>
        <form runat="server">
            <ext:ResourceManager runat="server" />
            <ext:ComboBox ID="ComboBox1" runat="server" LazyInit="false">
                <Items>
                    <ext:ListItem Text="Item 1" Value="1" />
                    <ext:ListItem Text="Item 2" Value="2" />
                </Items>
            </ext:ComboBox>
            <ext:ToolTip 
                runat="server" 
                Target="={#{ComboBox1}.list}" 
                Delegate=".x-combo-list-item" 
                TrackMouse="true" >
                <Listeners>
                    <Show Handler="this.body.update(this.triggerElement.innerHTML);" />
                </Listeners>
            </ext:ToolTip>
        </form>
    </body>
    </html>
  3. #3
    OK. Thanks for the help. Support on Ext.Net is very nice.
  4. #4
    is it Possible to show the Value of comboBox in the toolTip ?
    i tried

       <ToolTips>
                                                                                        <ext:ToolTip ID="ToolTip14" runat="server" Target="={#{drpRIC}.list}" TrackMouse="true">
                                                                                            <CustomConfig>
                                                                                                <ext:ConfigItem Name="delegate" Value=".x-combo-list-item" Mode="Value" />
                                                                                            </CustomConfig>
                                                                                            <Listeners>
                                                                                                
                                                                                                 <Show Handler="var record = drpRIC.findRecord(drpRIC.DisplayField, this.triggerElement.innerHTML); this.body.update( 'Value: ' + record.get(drpRIC.ValueField) + '<br /> Text: ' + record.get(drpRIC.DisplayField));"/>
                                                                                           </Listeners>
                                                                                        </ext:ToolTip>
                                                                                    </ToolTips>
    but it s not working ?? Any Advice ?? N.B still under version 0.8
    THank you in advancee
  5. #5
    Quote Originally Posted by FpNetWorth View Post
    is it Possible to show the Value of comboBox in the toolTip ?
    i tried

       <ToolTips>
                                                                                        <ext:ToolTip ID="ToolTip14" runat="server" Target="={#{drpRIC}.list}" TrackMouse="true">
                                                                                            <CustomConfig>
                                                                                                <ext:ConfigItem Name="delegate" Value=".x-combo-list-item" Mode="Value" />
                                                                                            </CustomConfig>
                                                                                            <Listeners>
                                                                                                
                                                                                                 <Show Handler="var record = drpRIC.findRecord(drpRIC.DisplayField, this.triggerElement.innerHTML); this.body.update( 'Value: ' + record.get(drpRIC.ValueField) + '<br /> Text: ' + record.get(drpRIC.DisplayField));"/>
                                                                                           </Listeners>
                                                                                        </ext:ToolTip>
                                                                                    </ToolTips>
    but it s not working ?? Any Advice ?? N.B still under version 0.8
    THank you in advancee
    @FpNetWorth - please start a new thread. If you feel two forum threads are related, feel free to cross link between them.
    Geoffrey McGill
    Founder

Similar Threads

  1. [CLOSED] GridPanel Cell Tooltips doesn't work in user control
    By skisly in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: May 09, 2011, 1:57 PM
  2. Replies: 2
    Last Post: Jan 28, 2010, 10:22 AM
  3. ext:HtmlEditor doesn't show tooltips
    By Vicentiu in forum 1.x Help
    Replies: 0
    Last Post: Jan 16, 2010, 3:09 AM
  4. Two binding combobox not work by items way
    By animalisme in forum 1.x Help
    Replies: 1
    Last Post: Sep 28, 2009, 3:30 AM
  5. Tooltips on Toolbar menu items not working
    By anup in forum 1.x Help
    Replies: 1
    Last Post: Aug 06, 2009, 12:25 PM

Tags for this Thread

Posting Permissions