|
| 1 | +# Syncfusion Angular Grid with Next.js server |
| 2 | + |
| 3 | +A lightweight, production-ready pattern for binding **Next.js** server data to a **Syncfusion Angular Grid**. The sample supports complete CRUD (Create, Read, Update, Delete), server-side filtering, searching, sorting, and paging using Syncfusion **DataManager**. |
| 4 | + |
| 5 | +## Key Features |
| 6 | + |
| 7 | +- **Syncfusion Angular Grid**: Built-in search, filter, sort, and paging capabilities |
| 8 | +- **Complete CRUD Operations**: Add, edit, delete, and update records directly from the grid |
| 9 | +- **Custom-Binding**: Full control over grid data operations (search, filter, sort, page and CRUD actions) |
| 10 | + |
| 11 | +## Prerequisites |
| 12 | + |
| 13 | + - Node.js: LTS version (v20.x or later) |
| 14 | + |
| 15 | + - npm/yarn: For package management. |
| 16 | + |
| 17 | + - Angular CLI: For creating and serving the Angular client application |
| 18 | + |
| 19 | +## Quick Start |
| 20 | + |
| 21 | +1. **Clone the repository** |
| 22 | + ```bash |
| 23 | + git clone <repository-url> |
| 24 | + cd Connecting_to_Next_js_server |
| 25 | + ``` |
| 26 | + |
| 27 | +2. **Run the application** |
| 28 | + |
| 29 | +**Run the Next.js server** |
| 30 | + |
| 31 | +```bash |
| 32 | + cd next_js_server |
| 33 | + npm run dev |
| 34 | +``` |
| 35 | + |
| 36 | +**Run the Angular client** |
| 37 | + |
| 38 | +```bash |
| 39 | + cd angular_client |
| 40 | + ng serve |
| 41 | +``` |
| 42 | + |
| 43 | +3. **Open the application** |
| 44 | + |
| 45 | + The server runs at http://localhost:3000 |
| 46 | + Navigate to the local URL displayed in the terminal (typically `http://localhost:3000`). |
| 47 | + |
| 48 | +## Configuration |
| 49 | + |
| 50 | +**Security Note**: For production environments, store sensitive credentials using: |
| 51 | + |
| 52 | +- Environment variables |
| 53 | + |
| 54 | +- Secure storage solutions (e.g., Azure Key Vault, AWS Secrets Manager) |
| 55 | + |
| 56 | +## Project Layout |
| 57 | + |
| 58 | +| File/Folder | Purpose | |
| 59 | +|-------------|---------| |
| 60 | +| `next_js_server/app/api/health_care/route.ts` | Server-side API route handling grid data operations | |
| 61 | +| `next_js_server/data/health_care_Entities.ts` | Entity model containing the data | |
| 62 | +| `angular_client/src/app/doctors/doctors.ts` | Contains the Grid configuration | |
| 63 | +| `angular_client/src/app/patients/patients.ts` | Dynamic route page | |
| 64 | + |
| 65 | +## Common Tasks |
| 66 | + |
| 67 | +### Add a Record |
| 68 | +1. Click the **Add** button in the toolbar |
| 69 | +2. Fill in the form fields (Doctor ID, Name, Specialty etc.) |
| 70 | +3. Click **Update** button in the toolbar to save the record. |
| 71 | + |
| 72 | +### Edit a Record |
| 73 | +1. Select a row in the grid |
| 74 | +2. Click the **Edit** button in the toolbar |
| 75 | +3. Modify the required fields |
| 76 | +4. Click **Update** to save changes |
| 77 | + |
| 78 | +### Delete a Record |
| 79 | +1. Select a row in the grid |
| 80 | +2. Click the **Delete** button in the toolbar |
| 81 | +3. Confirm the deletion |
| 82 | + |
| 83 | +### Search Records |
| 84 | +1. Use the **Search** box in the toolbar |
| 85 | +2. Enter keywords to filter records (searches across all columns) |
| 86 | + |
| 87 | +### Filter Records |
| 88 | +1. Click the filter icon in any column header |
| 89 | +2. Select filter criteria (equals, contains, greater than, etc.) |
| 90 | +3. Click **Filter** to apply |
| 91 | + |
| 92 | +### Sort Records |
| 93 | +1. Click the column header to sort ascending |
| 94 | +2. Click again to sort descending |
| 95 | + |
| 96 | +### Routing |
| 97 | +1. Click the **View Appointment Details** button in the template column of the Grid. |
| 98 | +2. This will navigate to the appointment details page. |
| 99 | + |
| 100 | +## Reference |
| 101 | +The [user guide](https://ej2.syncfusion.com/angular/documentation/grid/connecting-to-backends/next-js-server) provides detailed directions in a clear, step-by-step format. |
| 102 | + |
0 commit comments