|
27 | 27 | * <li>.onCheckBoxChange - ( function(item) ) Called to notify when a checkbox selection changes, default is none |
28 | 28 | * <li>.onSelect - ( function(item, event) ) Called to notify of item selection, default is none |
29 | 29 | * <li>.onSelectionChange - ( function(items) ) Called to notify when item selections change, default is none |
30 | | - * <li>.onClick - ( function(item, event) ) Called to notify when an item is clicked, default is none |
| 30 | + * <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 |
31 | 31 | * <li>.onDblClick - ( function(item, event) ) Called to notify when an item is double clicked, default is none |
32 | 32 | * </ul> |
33 | 33 | * @param {array} actionButtons List of action buttons in each row |
@@ -578,6 +578,7 @@ angular.module('patternfly.views').directive('pfListView', function ($window, pf |
578 | 578 | var alreadySelected; |
579 | 579 | var selectionChanged = false; |
580 | 580 | var continueEvent = true; |
| 581 | + var enableRowExpansion = scope.config && scope.config.useExpandingRows && item && !item.disableRowExpansion; |
581 | 582 |
|
582 | 583 | // Ignore disabled item clicks completely |
583 | 584 | if (scope.checkDisabled(item)) { |
@@ -620,7 +621,11 @@ angular.module('patternfly.views').directive('pfListView', function ($window, pf |
620 | 621 | } |
621 | 622 | } |
622 | 623 | if (scope.config.onClick) { |
623 | | - scope.config.onClick(item, e); |
| 624 | + if (scope.config.onClick(item, e) !== false && enableRowExpansion) { |
| 625 | + scope.toggleItemExpansion(item); |
| 626 | + } |
| 627 | + } else if (enableRowExpansion) { |
| 628 | + scope.toggleItemExpansion(item); |
624 | 629 | } |
625 | 630 |
|
626 | 631 | return continueEvent; |
|
0 commit comments