HomeHelpTrac

Changeset 15841 for trunk


Ignore:
Timestamp:
01/06/12 01:08:35 (5 months ago)
Author:
Alexander Trofimov
Message:

Grid - proper row disabling

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/inc/js/classes/BxDolGrid.js

    r15803 r15841  
    120120BxDolGrid.prototype.enable = function (sId, isEnable) { 
    121121    var e = jQuery('#' + sId); 
    122     if (isEnable) 
     122    if (isEnable) { 
     123        this._bindActionsSingle(e); 
    123124        e.removeClass('bx-grid-table-row-disabled bx-def-font-grayed'); 
    124     else 
     125        e.find('*[bx_grid_action_single]').removeClass('bx-btn-disabled'); 
     126    } else { 
     127        e.find('*[bx_grid_action_single]').addClass('bx-btn-disabled'); 
    125128        e.addClass('bx-grid-table-row-disabled bx-def-font-grayed'); 
     129        this._unbindActionsSingle(e); 
     130    } 
    126131} 
    127132 
     
    278283} 
    279284 
     285BxDolGrid.prototype._unbindActionsSingle = function (eElement) { 
     286    var elements; 
     287     
     288    if ('undefined' == typeof(eElement)) 
     289        elements = jQuery('#' + this._sIdWrapper + ' *[bx_grid_action_single]'); 
     290    else 
     291        elements = eElement.find('*[bx_grid_action_single]'); 
     292 
     293    elements.unbind('click'); 
     294} 
     295 
     296BxDolGrid.prototype._bindActionsSingle = function (eElement) { 
     297    var $this = this; 
     298    var elements; 
     299 
     300    if ('undefined' == typeof(eElement)) 
     301        elements = jQuery('#' + this._sIdWrapper + ' *[bx_grid_action_single]'); 
     302    else 
     303        elements = eElement.find('*[bx_grid_action_single]'); 
     304    console.log(elements.size()) 
     305 
     306    elements.bind('click', function () { 
     307        if ($(this).hasClass('bx-btn-disabled')) 
     308            return; 
     309        var sAction = $(this).attr('bx_grid_action_single'); 
     310        var sActionConfirm = $(this).attr('bx_grid_action_confirm'); 
     311        var sActionData = $(this).attr('bx_grid_action_data'); 
     312        $this.actionWithId (sActionData, sAction, {}, '', false, sActionConfirm); 
     313    }); 
     314 
     315} 
     316 
    280317BxDolGrid.prototype._bindActions = function (isSkipSearchInput) { 
    281318    var $this = this; 
     
    290327    }); 
    291328 
    292     jQuery('#' + this._sIdWrapper + ' *[bx_grid_action_single]').bind('click', function () { 
    293         if ($(this).hasClass('bx-btn-disabled')) 
    294             return; 
    295         var sAction = $(this).attr('bx_grid_action_single'); 
    296         var sActionConfirm = $(this).attr('bx_grid_action_confirm'); 
    297         var sActionData = $(this).attr('bx_grid_action_data'); 
    298         $this.actionWithId (sActionData, sAction, {}, '', false, sActionConfirm); 
    299     }); 
     329    this._bindActionsSingle (); 
    300330     
    301331    if (jQuery('#' + this._sIdWrapper + ' .bx-switcher-cont input').length)  
Note: See TracChangeset for help on using the changeset viewer.