Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Cascading select field: Keep child selection on parent change

Moritz Wagner
Contributor
March 17, 2020

Hello,

We're using the cascading select field as a "Matrix input" meaning each parent selection has the same child selections. Is is somehow possible with scriptrunner behaviours, to keep the selected child index selected, when the user changes the parent selection?

Or is there another possibility to simply have a matrix like input field?

 

Thanks!

2 answers

0 votes
Nic Brough -Adaptavist-
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 13, 2020

No, you can't do this.  Each "child" option in a cascading select belongs to its "parent" option.  Keeping a child selected when changing the parent is nonsense, because it would no longer be a valid selection.  (Technically, you could get Behaviours to do this on the surface, but then Jira will refuse to save the result because it's nonsense)

You should move to using two separate select lists if you need this sort of matrix.

Moritz Wagner
Contributor
April 19, 2020

I know the mechanics, and I know that It's a workaround, but since Jira is so limited, we need these workaround. It sure makes no sense when programming, but with jira these kinds of things are necessary to save you from loads of buggy plugins sadly.

 

Whatever, luckily our users can manage it themselves, until I find a way to fix it. 

I'll post the working "nonsense" later in here.

Nic Brough -Adaptavist-
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 21, 2020

So you're trying to bodge something that leads to presenting invalid data to your humans, who will then have to correct it before they can commit a change?  Why put them in that position?

Moritz Wagner
Contributor
April 21, 2020

Your fellow Payne did understand the use case correctly, you seem to miss it a little. No invalid data, and no correction anywhere just a simple automatism that helps the user. Just wait and maybe I get it to work to show you, so you know what I mean.

Nic Brough -Adaptavist-
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 21, 2020

Ok, but the way this is reading to me is that you want to show the user a field that is

parent 1 - child

then, when they change it to parent 2

you retain an invalid child that does not belong to parent 2, so they get

parent 1 - invalid data

Which they can't proceed with because it's wrong.  I'm curious as to how this is useful, let alone friendly to the user.

Moritz Wagner
Contributor
April 21, 2020

The use case is the following:

Selection:

Parent1 - P1 Child 3

User changes Parent 1 to parent 2 with jira default behavior the result would be: 

Parent2 - P2 Child 1

What I want to achieve, is that with changing the Parent the child is reassigned accordingly as follows:

Parent2 - P2 Child3

So no invalid data and no problems.

Nic Brough -Adaptavist-
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 21, 2020

But your same-named child is different objects - p1c3 is a different thing from p2c3 which means your data is invalid.

Moritz Wagner
Contributor
April 21, 2020

I know they are different objects, why should the data be invalid?

I can make the child selection by hand after changing the parent, so why should making the same change directly after parent change via script make the data invalid? 

 

If It would be possible to manipulate the website source it would be as simple as:

Javascript OnChange routine on parent select field with selecting the corresponding child right after the child select field is populated with the new select options - violà.

Whatever, the disscussion here doesn't help it's just slowing me down right now If anyone did something similar already a hint would be nice, else I'll try myself and eventually, if I find a working solution I'll post it right here.

Nic Brough -Adaptavist-
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 22, 2020

Again, each child option belongs to a parent.  When you have selected a child option, it belongs to a parent option. 

Your data is invalid if you have a child option that is from a different parent.  It's nonsense.

You aren't going to get any hints or a solution, what you're trying to do is useless as it will put nonsense data in front of the user, which Jira will then refuse to use because it is invalid.  If anyone has done anything similar, they've removed it after realising it is useless.

0 votes
Payne
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 17, 2020

If each parent has the same children, why use a cascading select field, and not simply 2 select fields?

Moritz Wagner
Contributor
March 18, 2020

Because Jira cannot display 2 fields in one line in edit screens and for the issue view two fields take a ridiculous amount of space compared to the cascading select method. That's the only reason to be honest. 

Like Payne likes this

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
VERSION
6.15.9
TAGS
AUG Leaders

Atlassian Community Events