HomeHelpTrac

Changeset 15943 for trunk/templates


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/templates/base
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • 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.