Conversation
|
@mixonic what's blocking this to be merged? missing tests? |
|
Never mind I’m not sure what this PR actually does |
f19e0aa to
edd5087
Compare
edd5087 to
6a3ffb7
Compare
6a3ffb7 to
e516eb8
Compare
twokul
left a comment
There was a problem hiding this comment.
👍 A couple of thoughts:
- can we add a test for this change?
- should we consider updating the docs to reflect this new API?
e516eb8 to
efeffb8
Compare
| /** | ||
| A function that will override how selection is compared to row value. | ||
|
|
||
| @argument selectionMatchFunction | ||
| @type function? | ||
| */ |
|
@twokul I added a test. For docs, see above how the JSDoc comment gets displayed on the docs website. I'm not sure that this function really warrants a full section in the examples. |
efeffb8 to
7696f96
Compare
twokul
left a comment
There was a problem hiding this comment.
Looks good to me!
Provisional ✅ (pending tests)
| isGroupSelected: computed( | ||
| '_tree.{selection.[],selectionMatchFunction}', | ||
| '_parentMeta.isSelected', | ||
| function() { | ||
| let rowValue = get(this, '_rowValue'); | ||
| let selection = get(this, '_tree.selection'); | ||
| let selectionMatchFunction = get(this, '_tree.selectionMatchFunction'); | ||
|
|
||
| isGroupSelected: computed('_tree.selection.[]', '_parentMeta.isSelected', function() { | ||
| let rowValue = get(this, '_rowValue'); | ||
| let selection = get(this, '_tree.selection'); | ||
| if (!selection || !isArray(selection)) { | ||
| return false; | ||
| } | ||
|
|
||
| if (!selection || !isArray(selection)) { | ||
| return false; | ||
| let isSelectionMatch = selectionMatchFunction | ||
| ? selection.filter(item => selectionMatchFunction(item, rowValue)).length > 0 | ||
| : selection.includes(rowValue); | ||
| return isSelectionMatch || get(this, '_parentMeta.isGroupSelected'); | ||
| } | ||
|
|
||
| return selection.includes(rowValue) || get(this, '_parentMeta.isGroupSelected'); | ||
| }), | ||
| ), |
There was a problem hiding this comment.
@twokul This set of changes is new and could probably use a final 👀
Adding the tests made me realize that the isGroupSelected CP also needed to use the selectionMatchFunction when matching selection against rows.
There was a problem hiding this comment.
Additional tests have been added to ensure that selectionMatchFunction works in both single and multiple modes
|
@kpfefferle did you get to follow up on the tests you wanted to add here? |
|
@mixonic I have not yet done that and it fell off my radar. I'll try to carve out some time to get back to that this week. |
78f58cd to
c1f8391
Compare
c1f8391 to
4b29a50
Compare
4b29a50 to
37cdfcc
Compare
|
@kpfefferle Thanks! Merging this. |
|
an example would be nice for this func |

This PR adds an optional
selectionMatchFunctionto theember-tbodycomponent. When set, this function will be used in place of===when checking to see if a row should be marked as selected.Fixes #823 (at least offers a workaround)