HomeHelpTrac

Changeset 15943 for trunk


Ignore:
Timestamp:
02/03/12 00:45:12 (4 months ago)
Author:
Alexander Trofimov
Message:

Grid - allow buttons to be enabled when whole row is disabled

Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/inc/classes/BxDolPage.php

    r15942 r15943  
    4242 *      - user level id = 3 -> 2^(3-1) = 4 
    4343 *      - user level id = 4 -> 2^(4-1) = 8 
    44  * - visible_for_levels_editable: it determines if 'visible_for_levels' field is ediable from page builder, visibility options can be overriden by custom class and shouldn't editable in this case. 
     44 * - visible_for_levels_editable: it determines if 'visible_for_levels' field is editable from page builder, visibility options can be overriden by custom class and shouldn't be editable in this case. 
    4545 * - url: the page url, if it is static page. 
    4646 * - meta_description: meta description of the page. 
  • trunk/inc/js/classes/BxDolGrid.js

    r15930 r15943  
    120120BxDolGrid.prototype.enable = function (sId, isEnable) { 
    121121    var e = jQuery('#' + sId); 
     122    var eActions = e.find('.bx-grid-cell-single-actions-wrapper *[bx_grid_action_single]').not('*[bx_grid_permanent_state]'); 
     123 
    122124    if (isEnable) {         
    123125        e.removeClass('bx-grid-table-row-disabled bx-def-font-grayed'); 
    124         e.find('*[bx_grid_action_single]').removeClass('bx-btn-disabled'); 
    125         this._bindActionsSingle(e); 
     126        eActions.removeClass('bx-btn-disabled'); 
     127        if (eActions.length) 
     128            this._bindActionsSingle(e); 
    126129    } else { 
    127         e.find('*[bx_grid_action_single]').addClass('bx-btn-disabled'); 
    128         e.addClass('bx-grid-table-row-disabled bx-def-font-grayed'); 
    129         this._unbindActionsSingle(e); 
     130        eActions.addClass('bx-btn-disabled'); 
     131        e.addClass('bx-grid-table-row-disabled bx-def-font-grayed');         
     132        if (eActions.length) 
     133            this._unbindActionsSingle(e); 
    130134    } 
    131135} 
  • trunk/samples/form_objects.php

    r15934 r15943  
    7575        // display add form 
    7676 
    77         $oForm = BxDolForm::getObjectInstance('sample2_form_objects', 'sample2_form_objects_add'); // get form instance for specified form object and display 
     77        $oForm = BxDolForm::getObjectInstance('sample_form_objects', 'sample_form_objects_add'); // get form instance for specified form object and display 
    7878        if (!$oForm) 
    7979            die('"sample_form_objects_add" form object or "sample_form_objects_add" display is not defined'); 
  • trunk/studio/templates/base/scripts/BxBaseStudioFormsFields.php

    r15911 r15943  
    178178    } 
    179179 
     180    protected function _getActionsDisabledBehavior($aRow) { 
     181        return false; 
     182    } 
    180183 
    181184    protected function _getFilterControls () { 
  • trunk/templates/base/css/grid.css

    r15736 r15943  
    7575 
    7676 
    77 td:last-child .bx-grid-cell-signge-actions-wrapper { 
     77td:last-child .bx-grid-cell-single-actions-wrapper { 
    7878    float:right; 
    7979} 
  • trunk/templates/base/scripts/BxBaseGrid.php

    r15929 r15943  
    266266    /** 
    267267     * Check if the whole row is disabled. 
    268      * When row is disabled checlbox is not selectable, actions aren't clickable and text is grayed out. 
     268     * When row is disabled - checkbox is not selectable, actions aren't clickable and text is grayed out. 
    269269     * By default all rows aren't disabled. 
    270270     * @param $aRow row array 
     
    277277    } 
    278278     
     279    /** 
     280     * Determine how actions are disabled when whole row is disabled. 
     281     * @param $aRow row array 
     282     * @return null - disable/enable actions when row is disabled/enabled, true - actions are always disabled, false - actions are always enabled 
     283     */ 
     284    protected function _getActionsDisabledBehavior($aRow) { 
     285        return null; 
     286    } 
     287 
    279288    /** 
    280289     * Check if the checkbox is disabled. 
     
    415424            isset($aField['width']) ? 'width:' . $aField['width'] : false  // add default styles 
    416425        ); 
    417         return '<td ' . $sAttr . '><div class="bx-grid-cell-signge-actions-wrapper">' . $this->_getActions('single', $aRow[$this->_aOptions['field_id']], false, $this->_isRowDisabled($aRow), $aRow) . '</div></td>'; 
     426 
     427        $mixedDisabledBehavior = $this->_getActionsDisabledBehavior($aRow); 
     428        $sActions = $this->_getActions('single', $aRow[$this->_aOptions['field_id']], false, null === $mixedDisabledBehavior ? $this->_isRowDisabled($aRow) : $mixedDisabledBehavior, null !== $mixedDisabledBehavior, $aRow); 
     429 
     430        return '<td ' . $sAttr . '><div class="bx-grid-cell-single-actions-wrapper">' . $sActions . '</div></td>'; 
    418431    } 
    419432 
     
    428441     
    429442 
    430     protected function _getActions ($sType, $sActionData = false, $isSmall = false, $isDisabled = false, $aRow = array()) { 
     443    protected function _getActions ($sType, $sActionData = false, $isSmall = false, $isDisabled = false, $isPermanentState = false, $aRow = array()) { 
    431444        $sActionsType = 'actions_' . $sType; 
    432445        if (empty($this->_aOptions[$sActionsType]) || !is_array($this->_aOptions[$sActionsType])) 
    433446            return ''; 
    434447        $sRet = ''; 
    435         foreach ($this->_aOptions[$sActionsType] as $sKey => $a) { 
     448        foreach ($this->_aOptions[$sActionsType] as $sKey => $a)  
     449{ 
    436450            $sFunc = '_getAction' . $this->_genMethodName($sKey); 
    437451            if (!method_exists($this, $sFunc)) 
    438452                $sFunc = empty($a) ? '_getActionDivider' : '_getActionDefault'; 
     453 
    439454            if (!isset($a['attr']['bx_grid_action'])) { 
    440455                $a['attr']['bx_grid_action_' . $sType] = $sKey; 
     
    444459                    $a['attr']['bx_grid_action_confirm'] = $a['confirm'] ? 1 : 0; 
    445460            } 
     461 
     462            if ($isPermanentState && !isset($a['attr']['bx_grid_permanent_state'])) 
     463                $a['attr']['bx_grid_permanent_state'] = 1; 
     464 
    446465            $sRet .= $this->$sFunc($sType, $sKey, $a, $isSmall, $isDisabled, $aRow); 
    447466        } 
Note: See TracChangeset for help on using the changeset viewer.