|
29 | 29 | * <li>.onCheckBoxChange - ( function(item) ) Called to notify when a checkbox selection changes, default is none
|
30 | 30 | * <li>.onSelect - ( function(item, event) ) Called to notify of item selection, default is none
|
31 | 31 | * <li>.onSelectionChange - ( function(items) ) Called to notify when item selections change, default is none
|
32 |
| - * <li>.onClick - ( function(item, event) ) Called to notify when an item is clicked, default is none |
| 32 | + * <li>.onClick - ( function(item, event) ) Called to notify when an item is clicked, default is none. Note: row expansion is the default behavior after onClick performed, but user can stop such default behavior by adding the sentence "return false;" to the end of onClick function body |
33 | 33 | * <li>.onDblClick - ( function(item, event) ) Called to notify when an item is double clicked, default is none
|
34 | 34 | * </ul>
|
35 | 35 | * @param {array} actionButtons List of action buttons in each row
|
@@ -582,6 +582,7 @@ angular.module('patternfly.views').component('pfListView', {
|
582 | 582 | var alreadySelected;
|
583 | 583 | var selectionChanged = false;
|
584 | 584 | var continueEvent = true;
|
| 585 | + var enableRowExpansion = ctrl.config && ctrl.config.useExpandingRows && item && !item.disableRowExpansion; |
585 | 586 |
|
586 | 587 | // Ignore disabled item clicks completely
|
587 | 588 | if (ctrl.checkDisabled(item)) {
|
@@ -624,7 +625,11 @@ angular.module('patternfly.views').component('pfListView', {
|
624 | 625 | }
|
625 | 626 | }
|
626 | 627 | if (ctrl.config.onClick) {
|
627 |
| - ctrl.config.onClick(item, e); |
| 628 | + if (ctrl.config.onClick(item, e) !== false && enableRowExpansion) { |
| 629 | + ctrl.toggleItemExpansion(item); |
| 630 | + } |
| 631 | + } else if (enableRowExpansion) { |
| 632 | + ctrl.toggleItemExpansion(item); |
628 | 633 | }
|
629 | 634 |
|
630 | 635 | return continueEvent;
|
|
0 commit comments