[CLOSED] TriggerField and "lookup" behavior when disabled

  1. #1

    [CLOSED] TriggerField and "lookup" behavior when disabled

    Hello,
    I am experiencing an issue that prevents the listeners for any "field" that is disabled or set as readonly.

    I created my own "Lookup" control (inheriting a TriggerField) that tracks the "Id" of a record on its "value" field.
    2) the user can choose an record finding by name or searching.
    3) the user can, clicking on the selection, open the "detail" window for that specific record,... so it does behave like a "link".

    Now, all works fine, except case "3" when the control is disabled.

    The issue is that ALL the trigger buttons and all the listeners for that field are disabled. This can be seen as "by design", however I wonder what happens if we need to have a "click" listener enabled to "navigate" to that record (case 3 state above) also when the control is actually disabled?

    Is there a way to override the way each since trigger is enabled/disabled on a TriggerField control?

    Thank you for help,
    Cheers
    Last edited by Daniil; Oct 22, 2013 at 2:37 PM. Reason: [CLOSED]
  2. #2
    Hi @adrianot,

    For the begging, please clarify why do you disable a control if you still need it to be functioning?
  3. #3
    Hi Daniil,

    In my mind, the control must be disabled only for "changes" ... but not for "navigation" commands.

    As an example, think about a control where a user could, when enabled, edit/insert an URL.

    Now, when I disable the control, I want to disable the editing of that URL, but NOT the navigation. That

    My own control is inherited from TriggerField it's a "record lookup". If I click over that control (also when disabled) I need to "navigate" to that entity opening the associated form.

    Actually I don't need to make any change, so the control must be still disabled, BUT "partially" I mean that some commands that do not change the control state are not disabled at all.

    Obviously since you can't implement this on the framework anyway, I think that there should be a way to override the "enable|disable" logic so that I could inject my own code...

    Is there a way to do that on a TriggerField-inherited control?
    Thank you in advance,
    Adriano
  4. #4
    Hello!

    Yes, you can try to override this disable/enable logic and it will work. To do so, you have to look into source of files of http://docs.sencha.com/extjs/3.4.0/#...m.TriggerField and in our SVN: http://svn.ext.net/premium/tags/1.7....riggerField.js

    Also, you can try to use the approach like below:

    <%@ Page Language="C#" %>
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <!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">
        <style>
            .customTriggerCtCls .x-item-disabled {
                opacity: 1 !important;
            }
    
            .x-item-disabled .customTriggerCls {
                opacity: 0.6;
            }
        </style>
    </head>
    <body>
        <form runat="server">
            <ext:ResourceManager runat="server" />
            
            <script>
                Ext.override(Ext.form.TriggerField, {
                    onCustomTriggerClick: function (evt, el, o) {
                            this.fireEvent("triggerclick", this, o.t, o.index, o.tag, evt);
                    }
                });
            </script>
            
            <ext:TriggerField 
                ID="TriggerField1" 
                runat="server" 
                Cls="customTriggerCls"
                CtCls="customTriggerCtCls"
                Width="200" 
                EmptyText="Click Trigger Button -->">
                <Listeners>
                    <TriggerClick Handler="Ext.Msg.alert('Message', 'You Clicked the Trigger!');" />
                </Listeners>
            </ext:TriggerField>
            
            <ext:TriggerField 
                ID="TriggerField2" 
                runat="server" 
                Width="200" 
                Editable="false"
                Cls="customTriggerCls"
                CtCls="customTriggerCtCls">
                <Triggers>
                    <ext:FieldTrigger Icon="Clear" Qtip="Click to clear field" HideTrigger="true" />
                    <ext:FieldTrigger Icon="Ellipsis" Qtip="Click to choose value" />
                </Triggers>
                <Listeners>
                    <TriggerClick Handler="Ext.Msg.alert('Message', 'You Clicked the Trigger!');" />
                </Listeners>
            </ext:TriggerField>
        </form>
    </body>
    </html>

Similar Threads

  1. [CLOSED] Combobox "starts with" behavior
    By Antonio09 in forum 2.x Legacy Premium Help
    Replies: 2
    Last Post: Oct 10, 2012, 8:57 PM
  2. Replies: 5
    Last Post: May 02, 2012, 5:37 PM
  3. Replies: 1
    Last Post: Oct 21, 2011, 6:15 PM
  4. Replies: 4
    Last Post: Oct 11, 2011, 2:42 AM
  5. TriggerField only accept the icon "Clear"
    By yyyhxm1 in forum 1.x Help
    Replies: 1
    Last Post: Aug 13, 2010, 8:54 PM

Tags for this Thread

Posting Permissions