surveyjs / survey-library

Free JavaScript form builder library with integration for React, Angular, Vue, jQuery, and Knockout.
https://surveyjs.io/form-library
MIT License
4.01k stars 782 forks source link

The displayValue should work with nested values (e.g., drop-down values located within a dynamic matrix or panel) #7876

Open JaneSjs opened 4 months ago

JaneSjs commented 4 months ago

T16865 - Using dynamic panel values in HTML markup https://surveyjs.answerdesk.io/internal/ticket/details/T16865


The displayValue function accepts the name of a question. However, when a drop-down question is located within a dynamic panel, it doesn't work. Similarly, it doesn't work for drop-down cells within a dynamic matrix.

displayValue('panel.activityCategories[0].activityCategory')

https://plnkr.co/edit/fnO7UhGaij9SlSJP


Another question: T16867 - Totals calculation https://surveyjs.answerdesk.io/internal/ticket/details/T16867

I created a separate Expression column to work around this: "sumInArray({question1}, 'Column 4')". Because the sumInArray didn't work if I pass the displayValue('Column 1').

@andrewtelnov it would be nice to have the displayValue function work out of the box in these scenarios.

andrewtelnov commented 4 months ago

@JaneSjs In general case, it is better to handle survey.onGetQuestionDisplayValue event. In the customer case, since they are using component, they can override getDisplayValue component handler.

Thank you, Andrew

JaneSjs commented 1 month ago

+1 https://github.com/surveyjs/survey-library/issues/8277