Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
using ASP_NET_Core.Models;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json;
using System.Text.Json;

namespace ASP_NET_Core.Controllers
{
Expand All @@ -24,9 +24,8 @@ public object Get(DataSourceLoadOptions loadOptions)
[HttpPost]
public IActionResult Post(string values)
{
var newEmployee = new EmployeeByState();
JsonConvert.PopulateObject(values, newEmployee);

var newEmployee = JsonSerializer.Deserialize<EmployeeByState>(values);
newEmployee.ID = SampleData.DataGridEmployeesByState.Max(a => a.ID) + 1;
if (!TryValidateModel(newEmployee))
return BadRequest("Failed to insert item");

Expand All @@ -40,7 +39,7 @@ public IActionResult Put(int key, string values)
{
var employee = SampleData.DataGridEmployeesByState.First(a => a.ID == key);

PopulateModel(JsonConvert.DeserializeObject<EmployeeByState>(values), employee);
PopulateModel(JsonSerializer.Deserialize<EmployeeByState>(values), employee);

if (!TryValidateModel(employee))
return BadRequest("Failed to update item");
Expand Down
14 changes: 10 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,22 @@ This example demonstrates how to implement cascading DropDownBoxes. The main ide
## Files to Review

- **jQuery**
- [index.html](jQuery/index.html)
- [index.html](jQuery/src/index.html)
- [index.js](jQuery/src/index.js)
- **Angular**
- [app.component.html](Angular/src/app/app.component.html)
- [app.component.ts](Angular/src/app/app.component.ts)
- **Vue**
- [App.vue](Vue/src/App.vue)
- [Home.vue](Vue/src//components/HomeContent.vue)
- [StateDropDownBoxComponent](Vue/src/components/StateDropDownBoxComponent.vue)
- [CityDropDownBoxComponent](Vue/src/components/CityDropDownBoxComponent.vue)
- [DropDownSaveBtnComponent](Vue/src/components/DropDownSaveBtnComponent.vue)
- **React**
- [App.js](React/src/App.js)
- [App.tsx](React/src/App.tsx)
- [DropDownBox.tsx](React/src/components/MultipleDropDownBox.tsx)
- [DropDownBoxSaveButton](React/src/components/DropDownBoxSave.tsx)
- **ASP.Net**
- [Index.cshtml](ASP.NET/DevExtremeAspNetCoreApp1/Views/Home/Index.cshtml)
- [Index.cshtml](ASP.NET%20Core/Views/Home/Index.cshtml)

## Documentation

Expand Down
4 changes: 2 additions & 2 deletions React/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import DataGrid, {
} from 'devextreme-react/data-grid';
import './App.css';
import ArrayStore from 'devextreme/data/array_store';
import { DataSource, type DataSourceOptions } from 'devextreme-react/common/data';
import { type DataSourceOptions } from 'devextreme-react/common/data';
import service, { type City, type Employee } from './data';
import MultipleDropDownBox from './components/MultipleDropDownBox';

Expand Down Expand Up @@ -47,7 +47,7 @@ function renderMultipleDropDownBox(
currentValue: number[],
// eslint-disable-next-line no-unused-vars
setValue: (value: number[]) => void,
dataSource: ArrayStore | DataSource,
dataSource: ArrayStore | DataSourceOptions,
): JSX.Element {
return (
<MultipleDropDownBox
Expand Down
4 changes: 3 additions & 1 deletion Vue/src/components/HomeContent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,9 @@ const getFilteredCities = (options: { data: Employee, key: number }): {
};
};

const cityDataSource = (cellInfo: DxDataGridTypes.ColumnEditCellTemplateData<Employee, number>): DataSource => {
const cityDataSource = (
cellInfo: DxDataGridTypes.ColumnEditCellTemplateData<Employee, number>
): DataSource => {
return new DataSource({
store: new ArrayStore({
data: cities,
Expand Down
Loading