kartik-v / yii2-tree-manager

An advanced tree management module using nested sets for Yii 2.
http://demos.krajee.com/tree-manager
Other
150 stars 107 forks source link

add a global_disabled property to buttons #167

Closed yanhuixie closed 7 years ago

yanhuixie commented 7 years ago
  1. add a global_disabled property to buttons, for the case you may want to disable some buttons through the whole session(before page refresh) but not each request/response. USAGE:
    'toolbar'=>[
    TreeView::BTN_CREATE => FALSE,
    TreeView::BTN_CREATE_ROOT => FALSE,
    TreeView::BTN_MOVE_LEFT => FALSE,
    TreeView::BTN_MOVE_RIGHT => FALSE,
    'mybtn' => [
        'icon' => 'copy',
        'options' => [
            'title' => 'blabla...', 
            'disabled' => $condition ? TRUE : FALSE, 
            'global_disabled' => $condition ? TRUE : FALSE, 
            'id'=>'btn_my',
            'value'=>Url::to(['foo/bar', 'sid'=>$model->id, ])
        ]
    ],
    ],
  2. add .gitignore file.
kartik-v commented 7 years ago

A new setting alwaysDisabled is available within buttons configuration (it will force disable the button always irrespective of other disabled settings). It is to be set like below

'toolbar'=>[
    'mybtn' => [
        'icon' => 'copy',
        'alwaysDisabled' => $condition ? TRUE : FALSE, 
        'options' => [
            'title' => 'blabla...', 
            'disabled' => $condition ? TRUE : FALSE, 
            'id'=>'btn_my'
        ]
    ],
],
yanhuixie commented 7 years ago

Oh, I'm sorry we nearly didn't update more than a year. I'm glad for the new setting, thank you!