[CLOSED] Problem with client overrides

  1. #1

    [CLOSED] Problem with client overrides

    Hi,

    I'm trying to put some custom override code in a centralized location that will be registered and included on every page. That works to some degree, however, I've encountered a problem. If specific UX controls are not physically present on a page, their Ext resources will not be included by default and the override will throw a client error.

    Ext.override(Ext.ux.Multiselect, {
        onViewBeforeClick: function (vw, index, node, e) {
            this.preClickSelections = this.view.getSelectedIndexes();
    
            if (this.disabled || this.readOnly || (this.preventDeselect && this.preClickSelections.indexOf(index) != -1)) {
                return false;
            }
        }
    });
    This resource is included by Ext framework at runtime I believe wherever the Multiselect control is present but otherwise it's missing causing an "undefined" error when the override code is parsed:

    <script type="text/javascript" src="/ux/extensions/multiselect/multiselect-js/ext.axd?v=12127"></script>
    Could you recommend a generic way of handling this problem?
    Last edited by Daniil; Apr 18, 2013 at 2:42 PM. Reason: [CLOSED]
  2. #2
    Hi Vadym,

    I think this way:
    if (Ext.ux && Ext.ux.Multiselect) {
        //override
    }
  3. #3
    Quote Originally Posted by Daniil View Post
    Hi Vadym,

    I think this way:
    if (Ext.ux && Ext.ux.Multiselect) {
        //override
    }
    Thanks Daniil, that should work for me. Please mark this question as closed.

Similar Threads

  1. Helpful Panel javascript overrides for 2.x
    By jchau in forum Examples and Extras
    Replies: 2
    Last Post: Feb 15, 2013, 2:02 PM
  2. [CLOSED] Problem initializing Gridfilters manually (client side)
    By henrik.sandberg in forum 2.x Legacy Premium Help
    Replies: 5
    Last Post: Nov 12, 2012, 12:29 PM
  3. Problem in Enable panel on client side
    By Rupesh in forum 1.x Help
    Replies: 1
    Last Post: Dec 15, 2010, 2:44 PM
  4. Form Panel Client Validation Problem
    By vivekrane1986 in forum 1.x Help
    Replies: 0
    Last Post: Jun 18, 2010, 9:26 AM
  5. Where to put overrides and extensions ideally
    By sz_146 in forum 1.x Help
    Replies: 4
    Last Post: Dec 05, 2008, 7:00 AM

Tags for this Thread

Posting Permissions