[CLOSED] Set up ImageCommand tooltip in prepareCommand javascript function

  1. #1

    [CLOSED] Set up ImageCommand tooltip in prepareCommand javascript function

    Hello is there a way to set (change) ImageCommand tooltip in prepareCommand function?

    I know we can set it in render function ( metaData.attr= 'ext:qtip= ) but for some reason I can't do that.

    See the code below: ' command.tooltip ' was a try but it looks like there's no such a property.

    Any idea?



    
    
    function prepareCommand(grid, command, record, row) {
    // need to get selection state
        if (command.command == 'Action') {
            
            // need to get value from stoStatuses and depending on that to display command
    
            value = getSelectStatus(record.data.ClientVendorID);
           
            switch (value) {
                case -1:
                    command.hidden = true;
                    command.hideMode = 'display';
                case 0:
                    command.iconCls = 'state0';
                    command.tooltip = 'state 0';
                    break;
                case 1:
                    command.iconCls = 'state1';
                    command.tooltip = 'state 1';
                    break;
                case 2:
                    command.iconCls = 'state2';
                    command.tooltip = 'state 2';
                    break;
            }
            
        }
    }
    
      
    
    
    
    <ext:Column DataIndex="state" MenuDisabled="true" Sortable="false" Resizable="false" Locked="true">
                            <Renderer Fn="renderState" />
                            <Commands>
                                <ext:ImageCommand CommandName="Action" Cls="center" />
                            </Commands>
                            <PrepareCommand Fn="prepareCommand" />
                        </ext:Column>
    Last edited by Daniil; Jan 24, 2011 at 1:07 PM. Reason: [CLOSED]
  2. #2
    Hi,

    Please set .qtitle a .qtip properties of command object.

    Example
    <%@ 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)
            {
                Store store = this.GridPanel1.GetStore();
                store.DataSource = new object[] 
                { 
                    new object[] {"test1"},
                    new object[] {"test2"},
                    new object[] {"test3"}
                };
                store.DataBind();
            }
        }
    </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 runat="server">
        <title>Ext.Net Example</title>
    </head>
    <body>
        <form runat="server">
        <ext:ResourceManager runat="server" />
        <ext:GridPanel ID="GridPanel1" runat="server" AutoHeight="true">
            <Store>
                <ext:Store runat="server">
                    <Reader>
                        <ext:ArrayReader>
                            <Fields>
                                <ext:RecordField Name="test" />
                            </Fields>
                        </ext:ArrayReader>
                    </Reader>
                </ext:Store>
            </Store>
            <ColumnModel runat="server">
                <Columns>
                    <ext:Column Header="Test" DataIndex="test">
                        <Commands>
                            <ext:ImageCommand CommandName="test" Icon="Accept" />
                        </Commands>
                        <PrepareCommand Handler="command.qtitle = 'Your title'; command.qtip = 'Your text';" />
                    </ext:Column>
                </Columns>
            </ColumnModel>
        </ext:GridPanel>
        </form>
    </body>
    </html>
  3. #3
    Daniil,

    it doesn't work for me.

    Tried with your example in Firefox.
    Using Ext.Net.dll version 1.0.3995.25674.

    Any idea?


    Thanks
  4. #4
    Hi,

    Please use
    command.qtext
    instead of
    command.qtip
  5. #5
    Looks like Bug, it sets qtitle but not the qtip:

    
    <div ext:qtitle="Your title" ext:qtip="" style="" class="cell-imagecommand   icon-accept " cmd="test"></div>
  6. #6
    ok this works, thanks!
  7. #7
    Related solution for Ext.NET 2.x : http://forums.ext.net/showthread.php?23844

Similar Threads

  1. [CLOSED] grid parameter is null for prepareCommand function in 1.0.
    By vedagopal2004 in forum 1.x Legacy Premium Help
    Replies: 5
    Last Post: Feb 14, 2011, 7:47 AM
  2. [CLOSED] Call Javascript Function
    By speedstepmem4 in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Jul 21, 2010, 3:58 AM
  3. [CLOSED] How to use #{...} syntax within javascript function
    By jmcantrell in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Jun 21, 2010, 4:38 PM
  4. How i can html of tooltip in javascript function
    By vucuongkg in forum 1.x Help
    Replies: 1
    Last Post: Jun 17, 2010, 4:05 PM
  5. [CLOSED] The javascript function in not fire?
    By Etisbew in forum 1.x Legacy Premium Help
    Replies: 7
    Last Post: Sep 09, 2009, 10:12 AM

Tags for this Thread

Posting Permissions