T26775 - Multi page form show the count of questions on each page title
https://surveyjs.answerdesk.io/internal/ticket/details/T26775
T23589 - Table of Contents - Display the number of total and answered questions
https://surveyjs.answerdesk.io/internal/ticket/details/T23589
T14475 - Is it possible to show the progress bar based on the pages?
https://surveyjs.answerdesk.io/internal/ticket/details/T14475
The current API: View Demo.
class CustomTOCItem extends ReactSurveyElement {
constructor(props) {
super(props);
}
render() {
const survey = this.props.model.locOwner;
const pageName = this.props.item.id;
const page = survey.getPageByName(pageName);
const pageQuestions = page.questions;
const totalNumberOfQuestions = pageQuestions.length;
const answeredQuestionsPerPage = pageQuestions.filter(question => !question.isEmpty()).length;
const text = page.title || page.name;
const content = (
<span>
{text} {" (Answered "}
<strong>{answeredQuestionsPerPage}</strong>
{"/"}
<strong>{totalNumberOfQuestions}</strong>
{")"}
</span>
);
const backgroundClass =
answeredQuestionsPerPage === 0
? "no-answered"
: answeredQuestionsPerPage === totalNumberOfQuestions
? "all-answered"
: "some-answered";
return (
<div className={`toc-item-container ${backgroundClass}`}>
{content}
</div>
);
}
}
ReactElementFactory.Instance.registerElement("sv-custom-toc-item", (props) => {
return React.createElement(CustomTOCItem, props);
});
//...
survey.findLayoutElement("toc-navigation").getData().listModel.itemComponent = "sv-custom-toc-item";
Please consider the following API enhancements:
survey.tocItemComponent = "sv-custom-toc-item";
T26775 - Multi page form show the count of questions on each page title
https://surveyjs.answerdesk.io/internal/ticket/details/T26775
T23589 - Table of Contents - Display the number of total and answered questions
https://surveyjs.answerdesk.io/internal/ticket/details/T23589
T14475 - Is it possible to show the progress bar based on the pages?
https://surveyjs.answerdesk.io/internal/ticket/details/T14475
The current API: View Demo.
Please consider the following API enhancements:
SurveyModelwhich would allow developers to specify a custom TOC component name.const survey = this.props.model.locOwner, usethis.props.surveythis.props.page.this.props.itemto access a current IAction.