Skip to content

Commit

Permalink
Merge branch 'master' into feature/48-remote-data-for-summary-visuali…
Browse files Browse the repository at this point in the history
…zers
  • Loading branch information
tsv2013 committed Jun 28, 2024
2 parents a5dbdb0 + b906869 commit 159554b
Show file tree
Hide file tree
Showing 11 changed files with 170 additions and 72 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

### [1.11.4](https://github.com/surveyjs/survey-analytics/compare/v1.11.3...v1.11.4) (2024-06-25)

### [1.11.3](https://github.com/surveyjs/survey-analytics/compare/v1.11.2...v1.11.3) (2024-06-19)

### [1.11.2](https://github.com/surveyjs/survey-analytics/compare/v1.11.1...v1.11.2) (2024-06-11)
Expand Down
32 changes: 22 additions & 10 deletions docs/set-up-table-view-angular.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ description: Convert your survey data to manageable table format for easy filte

# Table View for Survey Results in an Angular Application

This step-by-step tutorial will help you set up a table view for survey results using SurveyJS Dashboard in an Angular application. To add the table view to your application, follow the steps below:
This step-by-step tutorial will help you set up a Table View for survey results using SurveyJS Dashboard in an Angular application. To add the Table View to your application, follow the steps below:

- [Install the `survey-analytics` npm Package](#install-the-survey-analytics-npm-package)
- [Configure Styles](#configure-styles)
Expand All @@ -31,11 +31,11 @@ SurveyJS Dashboard is distributed as a <a href="https://www.npmjs.com/package/su
npm install survey-analytics --save
```

The table view for SurveyJS Dashboard depends on the <a href="https://tabulator.info/" target="_blank">Tabulator</a> library. The command above automatically installs it as a dependency.
The Table View for SurveyJS Dashboard depends on the <a href="https://tabulator.info/" target="_blank">Tabulator</a> library. The command above automatically installs it as a dependency.

## Configure Styles

Open the `angular.json` file and reference the Tabulator and table view style sheets:
Open the `angular.json` file and reference the Tabulator and Table View style sheets:

```js
{
Expand Down Expand Up @@ -66,9 +66,19 @@ Open the `angular.json` file and reference the Tabulator and table view style sh

## Load Survey Results

You can access survey results as a JSON object within the `SurveyModel`'s `onComplete` event handler. Send the results to your server and store them with a specific survey ID. Refer to the [Handle Survey Completion](/form-library/documentation/get-started-angular#handle-survey-completion) help topic for more information.
When a respondent completes a survey, a JSON object with their answers is passed to the `SurveyModel`'s [`onComplete`](https://surveyjs.io/form-library/documentation/api-reference/survey-data-model#onComplete) event handler. You should send this object to your server and store it with a specific survey ID (see [Handle Survey Completion](/form-library/documentation/get-started-angular#handle-survey-completion)). A collection of such JSON objects is a data source for the Table View. This collection can be processed (sorted, filtered, paginated) on the server or on the client.

To load the survey results, send the survey ID to your server and return an array of JSON objects:
### Server-Side Data Processing

Server-side data processing enables the Table View to load survey results in small batches on demand and delegate sorting and filtering to the server. For this feature to work, the server must support these data operations. Refer to the following demo example on GitHub for information on how to configure the server and the client for this usage scenario:

[SurveyJS Dashboard: Table View - Server-Side Data Processing Demo Example](https://github.com/surveyjs/surveyjs-dashboard-table-view-nodejs-mongodb (linkStyle))

### Client-Side Data Processing

When data is processed on the client, the Table View loads the entire dataset at startup and applies sorting and filtering in a user's browser. This demands faster web connection and higher computing power but works smoother with small datasets.

To load survey results to the client, send the survey ID to your server and return an array of JSON objects with survey results:

```js
import { AfterViewInit, Component } from '@angular/core';
Expand All @@ -84,7 +94,7 @@ export class AppComponent implements AfterViewInit {
loadSurveyResults("https://your-web-service.com/" + SURVEY_ID)
.then((surveyResults) => {
// ...
// Configure and render the table view here
// Configure and render the Table View here
// Refer to the help topics below
// ...
});
Expand Down Expand Up @@ -154,7 +164,7 @@ function generateData() {

## Render the Table

The table view is rendered by the `Tabulator` component. Import this component and pass the survey model and results to its constructor to instantiate it. Assign the produced instance to a constant that will be used later to render the component:
The Table View is rendered by the `Tabulator` component. Import this component and pass the survey model and results to its constructor to instantiate it. Assign the produced instance to a constant that will be used later to render the component:

```js
import { AfterViewInit, Component } from '@angular/core';
Expand All @@ -178,14 +188,14 @@ export class AppComponent implements AfterViewInit {
}
```

Switch to the component template and add a page element that will serve as the table view container:
Switch to the component template and add a page element that will serve as the Table View container:

```html
<!-- app.component.html -->
<div id="surveyDataTable"></div>
```

To render the table view in the page element, call the `render(containerId)` method on the Tabulator instance you created previously:
To render the Table View in the page element, call the `render(containerId)` method on the Tabulator instance you created previously:

```js
// ...
Expand Down Expand Up @@ -273,7 +283,7 @@ export class AppComponent implements AfterViewInit {

## Enable Export to PDF and Excel

The table view for SurveyJS Dashboard allows users to save survey results as CSV, PDF, and XLSX documents. Export to CSV is supported out of the box. For export to PDF and XLSX, you need to reference the <a href="https://github.com/parallax/jsPDF#readme" target="_blank">jsPDF</a>, <a href="https://github.com/JonatanPe/jsPDF-AutoTable#readme" target="_blank">jsPDF-AutoTable</a>, and <a href="https://sheetjs.com/" target="_blank">SheetJS</a> libraries. Open the `index.html` file in your project and add the following links to the `<head>` element:
The Table View for SurveyJS Dashboard allows users to save survey results as CSV, PDF, and XLSX documents. Export to CSV is supported out of the box. For export to PDF and XLSX, you need to reference the <a href="https://github.com/parallax/jsPDF#readme" target="_blank">jsPDF</a>, <a href="https://github.com/JonatanPe/jsPDF-AutoTable#readme" target="_blank">jsPDF-AutoTable</a>, and <a href="https://sheetjs.com/" target="_blank">SheetJS</a> libraries. Open the `index.html` file in your project and add the following links to the `<head>` element:

```html
<!-- jsPDF for export to PDF -->
Expand All @@ -288,6 +298,8 @@ To view the application, run `ng serve` in a command line and open [http://local

![SurveyJS Dashboard: Export survey data to PDF, XLSX, and CSV](../images/export-to-pdf-xlsx-csv.png)

> With [server-side data processing](#server-side-data-processing), exported documents contain only currently loaded data records. To export full datasets, you need to generate the documents on the server.
[View Full Code on GitHub](https://github.com/surveyjs/code-examples/tree/main/dashboard-table-view/angular (linkStyle))

## See Also
Expand Down
26 changes: 19 additions & 7 deletions docs/set-up-table-view-knockout-jquery.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ description: Convert your survey data to manageable table format for easy filte

# Table View for Survey Results in a Knockout or jQuery Application

This step-by-step tutorial will help you set up a table view for survey results using SurveyJS Dashboard in a Knockout or jQuery application. To add the table view to your application, follow the steps below:
This step-by-step tutorial will help you set up a Table View for survey results using SurveyJS Dashboard in a Knockout or jQuery application. To add the Table View to your application, follow the steps below:

- [Link Resources](#link-resources)
- [Load Survey Results](#load-survey-results)
Expand Down Expand Up @@ -73,17 +73,29 @@ The following code shows how to reference these libraries:

## Load Survey Results

You can access survey results as a JSON object within the `SurveyModel`'s `onComplete` event handler. Send the results to your server and store them with a specific survey ID. Refer to the [Handle Survey Completion](/Documentation/Library?id=get-started-knockout#handle-survey-completion) help topic for more information.
When a respondent completes a survey, a JSON object with their answers is passed to the `SurveyModel`'s [`onComplete`](https://surveyjs.io/form-library/documentation/api-reference/survey-data-model#onComplete) event handler. You should send this object to your server and store it with a specific survey ID (see [Handle Survey Completion](/form-library/documentation/get-started-knockout#handle-survey-completion)). A collection of such JSON objects is a data source for the Table View. This collection can be processed (sorted, filtered, paginated) on the server or on the client.

To load the survey results, send the survey ID to your server and return an array of JSON objects:
### Server-Side Data Processing

Server-side data processing enables the Table View to load survey results in small batches on demand and delegate sorting and filtering to the server. For this feature to work, the server must support these data operations. Refer to the following demo example on GitHub for information on how to configure the server and the client for this usage scenario:

[SurveyJS Dashboard: Table View - Server-Side Data Processing Demo Example](https://github.com/surveyjs/surveyjs-dashboard-table-view-nodejs-mongodb (linkStyle))

> The Table View allows users to save survey results as CSV, PDF, and XLSX documents. With server-side data processing, these documents contain only currently loaded data records. To export full datasets, you need to generate the documents on the server.
### Client-Side Data Processing

When data is processed on the client, the Table View loads the entire dataset at startup and applies sorting and filtering in a user's browser. This demands faster web connection and higher computing power but works smoother with small datasets.

To load survey results to the client, send the survey ID to your server and return an array of JSON objects with survey results:

```js
const SURVEY_ID = 1;

loadSurveyResults("https://your-web-service.com/" + SURVEY_ID)
.then((surveyResults) => {
// ...
// Configure and render the table view here
// Configure and render the Table View here
// Refer to the help topics below
// ...
});
Expand Down Expand Up @@ -151,7 +163,7 @@ function generateData() {

## Render the Table

The table view is rendered by the `Tabulator` component. Pass the survey model and results to its constructor to instantiate it. Assign the produced instance to a constant that will be used later to render the component:
The Table View is rendered by the `Tabulator` component. Pass the survey model and results to its constructor to instantiate it. Assign the produced instance to a constant that will be used later to render the component:

```js
const surveyJson = { /* ... */ };
Expand All @@ -165,15 +177,15 @@ const surveyDataTable = new SurveyAnalyticsTabulator.Tabulator(
);
```

The table view should be rendered in a page element. Add this element to the page markup:
The Table View should be rendered in a page element. Add this element to the page markup:

```html
<body>
<div id="surveyDataTable"></div>
</body>
```

To render the table view in the page element, call the `render(containerId)` method on the Tabulator instance you created previously:
To render the Table View in the page element, call the `render(containerId)` method on the Tabulator instance you created previously:

```js
document.addEventListener("DOMContentLoaded", function() {
Expand Down
32 changes: 22 additions & 10 deletions docs/set-up-table-view-react.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ description: Convert your survey data to manageable table format for easy filte

# Table View for Survey Results in a React Application

This step-by-step tutorial will help you set up a table view for survey results using SurveyJS Dashboard in a React application. To add the table view to your application, follow the steps below:
This step-by-step tutorial will help you set up a Table View for survey results using SurveyJS Dashboard in a React application. To add the Table View to your application, follow the steps below:

- [Install the `survey-analytics` npm Package](#install-the-survey-analytics-npm-package)
- [Configure Styles](#configure-styles)
Expand Down Expand Up @@ -35,11 +35,11 @@ SurveyJS Dashboard is distributed as a <a href="https://www.npmjs.com/package/su
npm install survey-analytics --save
```

The table view for SurveyJS Dashboard depends on the <a href="https://tabulator.info/" target="_blank">Tabulator</a> library. The command above automatically installs it as a dependency.
The Table View for SurveyJS Dashboard depends on the <a href="https://tabulator.info/" target="_blank">Tabulator</a> library. The command above automatically installs it as a dependency.

## Configure Styles

Import the Tabulator and table view style sheets in the component that will render the table view:
Import the Tabulator and Table View style sheets in the component that will render the Table View:

```js
import 'tabulator-tables/dist/css/tabulator.min.css';
Expand All @@ -48,9 +48,19 @@ import 'survey-analytics/survey.analytics.tabulator.min.css';

## Load Survey Results

You can access survey results as a JSON object within the `SurveyModel`'s `onComplete` event handler. Send the results to your server and store them with a specific survey ID. Refer to the [Handle Survey Completion](/form-library/documentation/get-started-react#handle-survey-completion) help topic for more information.
When a respondent completes a survey, a JSON object with their answers is passed to the `SurveyModel`'s [`onComplete`](https://surveyjs.io/form-library/documentation/api-reference/survey-data-model#onComplete) event handler. You should send this object to your server and store it with a specific survey ID (see [Handle Survey Completion](/form-library/documentation/get-started-react#handle-survey-completion)). A collection of such JSON objects is a data source for the Table View. This collection can be processed (sorted, filtered, paginated) on the server or on the client.

To load the survey results, send the survey ID to your server and return an array of JSON objects:
### Server-Side Data Processing

Server-side data processing enables the Table View to load survey results in small batches on demand and delegate sorting and filtering to the server. For this feature to work, the server must support these data operations. Refer to the following demo example on GitHub for information on how to configure the server and the client for this usage scenario:

[SurveyJS Dashboard: Table View - Server-Side Data Processing Demo Example](https://github.com/surveyjs/surveyjs-dashboard-table-view-nodejs-mongodb (linkStyle))

### Client-Side Data Processing

When data is processed on the client, the Table View loads the entire dataset at startup and applies sorting and filtering in a user's browser. This demands faster web connection and higher computing power but works smoother with small datasets.

To load survey results to the client, send the survey ID to your server and return an array of JSON objects with survey results:

```js
// ...
Expand All @@ -65,7 +75,7 @@ export default function App() {
loadSurveyResults("https://your-web-service.com/" + SURVEY_ID)
.then((surveyResults) => {
// ...
// Configure the table view here
// Configure the Table View here
// Refer to the help topics below
// ...
});
Expand Down Expand Up @@ -137,7 +147,7 @@ function generateData() {

## Render the Table

The table view is rendered by the `Tabulator` component. Import this component and pass the survey model and results to its constructor to instantiate it. Save the produced instance in a state variable that will be used later to render the component:
The Table View is rendered by the `Tabulator` component. Import this component and pass the survey model and results to its constructor to instantiate it. Save the produced instance in a state variable that will be used later to render the component:

```js
// ...
Expand Down Expand Up @@ -174,7 +184,7 @@ export default function App() {
}
```

The table view should be rendered in a page element. Add this element to the component markup, as shown below.
The Table View should be rendered in a page element. Add this element to the component markup, as shown below.

```js
// Uncomment the following line if you are using Next.js:
Expand All @@ -189,7 +199,7 @@ export default function App() {
}
```

To render the table view in the page element, call the `render(containerId)` method on the Tabulator instance you created previously:
To render the Table View in the page element, call the `render(containerId)` method on the Tabulator instance you created previously:

```js
import { ..., useEffect } from 'react';
Expand Down Expand Up @@ -297,7 +307,7 @@ export default function App() {

## Enable Export to PDF and Excel

The table view for SurveyJS Dashboard allows users to save survey results as CSV, PDF, and XLSX documents. Export to CSV is supported out of the box. For export to PDF and XLSX, you need to reference the <a href="https://github.com/parallax/jsPDF#readme" target="_blank">jsPDF</a>, <a href="https://github.com/JonatanPe/jsPDF-AutoTable#readme" target="_blank">jsPDF-AutoTable</a>, and <a href="https://sheetjs.com/" target="_blank">SheetJS</a> libraries. Open the `index.html` file in your project and add the following links to the `<head>` element:
The Table View for SurveyJS Dashboard allows users to save survey results as CSV, PDF, and XLSX documents. Export to CSV is supported out of the box. For export to PDF and XLSX, you need to reference the <a href="https://github.com/parallax/jsPDF#readme" target="_blank">jsPDF</a>, <a href="https://github.com/JonatanPe/jsPDF-AutoTable#readme" target="_blank">jsPDF-AutoTable</a>, and <a href="https://sheetjs.com/" target="_blank">SheetJS</a> libraries. Open the `index.html` file in your project and add the following links to the `<head>` element:

```html
<!-- jsPDF for export to PDF -->
Expand All @@ -312,6 +322,8 @@ To view the application, run `npm run start` in a command line and open [http://

![SurveyJS Dashboard: Export survey data to PDF, XLSX, and CSV](../images/export-to-pdf-xlsx-csv.png)

> With [server-side data processing](#server-side-data-processing), exported documents contain only currently loaded data records. To export full datasets, you need to generate the documents on the server.
[View Full Code on GitHub](https://github.com/surveyjs/code-examples/tree/main/dashboard-table-view/react (linkStyle))

## See Also
Expand Down
Loading

0 comments on commit 159554b

Please sign in to comment.