Survey-library: visibleIf with matrixdynamic columns

Created on 4 May 2017  路  8Comments  路  Source: surveyjs/survey-library

Currently I'm trying to get visibleIf to work with the matrixdynamic columns but it doesn't seem to work as I need it. I want certain columns to display depending on the choices from other columns. Although in the below example I'm also using the same column title for 2 possible sets of choices. Perhaps a way to dynamically change the choices content would be better?

Example:

columns: [{ name: "asReporting", title: "Reporting Cycle", cellType: "dropdown", choices: ["Monthly", "Quarterly"]}, 
{ name: "asPeriodMonthly", title: "Period", cellType: "dropdown", visibleIf: "{asReporting}='Monthly'", 
choices: ["January (01)", "February (02)", "March (03)", "April (04)", "May (05)", "June (06)", "July (07)", "August (08)", "September (09)", "October (10)", "November (11)", "December (12)"]}, 
{ name: "asPeriodQuarterly", title: "Period", cellType: "dropdown", visibleIf: "{asReporting}='Quarterly'", 
choices: ["Quarter 1 (Jul, Aug, Sept)", "Quarter 2 (Oct, Nov, Dec)", "Quarter 3 (Jan, Feb, Mar)", "Quarter 4 (Apr, May, Jun)"]}
Implemented enhancement question

Most helpful comment

@Kuhax @nategasm guys, please take a look at new events I have added:
The event description: https://github.com/surveyjs/surveyjs/issues/400
A plunker demo: http://plnkr.co/edit/eCNxoNUjNylXebBlEuDX?p=preview

All 8 comments

@nategasm Yes, it would not work. We do not have visibleIf property in the column.
In fact, I do not understand how it may work at all.
What if a person chose month period in the first row and quarter in the second? You will have to show two columns, two periods: month and quarter. It will confuse end-user for sure.
You may have one colum: Period and it will combine choices for months and quarters.
You may have one separate dropdown question: asReporting. It will show/hide different matrix with month period or quarter period.

Thank you,
Andrew

Hello @andrewtelnov. Currently I'm going through same issue. I would like to make visible or to hide one of the columns in one given row of matrixdynamic depending on the value of another column from the same row. Example: (first row of matrixdynamic) - COL1 {Dropdown} COL2 {Boolean} COL3 {show TextEdit if COL2 = true} - same for all added rows.

I know there is no such feature in matrixdynamic yet. Could you suggest any solutions to overcome this issue?

Thank you in advance.

@Kuhax I do not know how to implement it. How do you want to make it work? Unless I something misunderstand.

| Column1 | Column2 | Column3 |
| ------------- |:-------------:| -----:|
| make column 2 invisible | I have to be invisible | I have to be visible |
| make column 3 invisible | I have to be visible | I have to be invisible |

@andrewtelnov How I imagined it would work is where if all rows in a column are invisible, then the whole column would be invisible. Otherwise the cell will just simply be blank. In your case above:

Column1 | Column2 | Column3
------------ | ------------- | -------------
make column 2 invisible | | I have to be visible
make column 3 invisible | I have to be visible |

Another case combining both concepts:

Column1 | Column3 | Column4
------------ | ------------- | -------------
make column 2 invisible | make column 4 visible | I have to be visible
make column 2 invisible | make column 4 invisible |

@andrewtelnov your example is valid for my purpose as it allows to hide separate columns for the same row. Also, in my opinion, the ability to hide columns in matrixdynamic makes it much more powerful since it's one of the most used widgets.

The following example explains what I am trying to achieve in a particular case.

Product description Do you like it? Please explain why not
Some product YES I have to be hidden
Another product NO I have to be visible

Thanks for your time.

@Kuhax @nategasm guys, please take a look at new events I have added:
The event description: https://github.com/surveyjs/surveyjs/issues/400
A plunker demo: http://plnkr.co/edit/eCNxoNUjNylXebBlEuDX?p=preview

Thanks @andrewtelnov that works fine for my purposes

@andrewtelnov that works for me as well. Thanks !

Was this page helpful?
0 / 5 - 0 ratings