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 @@ -44,8 +44,12 @@ export class AppComponent {
});
}

itemTypeExpr(obj) {
return `employee${obj.ID}`;
itemTypeExpr(obj, value) {
if (value === undefined) {
return `employee${obj.ID}`;
}
obj.type = value;
return null;
}

showInfo(employee) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,12 @@ const dataSource = new ArrayStore({
data: employees,
});

function itemTypeExpr(obj: { ID: number; }) {
return `employee${obj.ID}`;
function itemTypeExpr(obj: { ID: number; type: string; }, value: string) {
if (value === undefined) {
return `employee${obj.ID}`;
}
obj.type = value;
return null;
}

export default function App() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,12 @@ const dataSource = new ArrayStore({
key: 'ID',
data: employees,
});
function itemTypeExpr(obj) {
return `employee${obj.ID}`;
function itemTypeExpr(obj, value) {
if (value === undefined) {
return `employee${obj.ID}`;
}
obj.type = value;
return null;
}
export default function App() {
const [currentEmployee, setCurrentEmployee] = useState({});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,13 @@ const dataSource = new ArrayStore({
});
const currentEmployee = ref({} as Record<string, any>);
const popupVisible = ref(false);
const itemTypeExpr = ({ ID }: any) => `employee${ID}`;
const itemTypeExpr = (obj: { ID: number; type: string; }, value: string) => {
if (value === undefined) {
return `employee${obj.ID}`;
}
obj.type = value;
return null;
};

function showInfo(employee: any) {
currentEmployee.value = employee;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,13 @@ $(() => {
data: employees,
}),
keyExpr: 'ID',
typeExpr(obj) { return `employee${obj.ID}`; },
typeExpr(obj, value) {
if (value === undefined) {
return `employee${obj.ID}`;
}
obj.type = value;
return null;
},
parentKeyExpr: 'Head_ID',
autoLayout: {
type: 'tree',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,12 @@ export class AppComponent {
});
}

itemTypeExpr() {
return 'employee';
itemTypeExpr(obj, value) {
if (value === undefined) {
return 'employee';
}
obj.type = value;
return null;
}

itemCustomDataExpr(obj, value) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,12 @@ function deleteEmployee(employee: Employee) {
dataSource.push([{ type: 'remove', key: employee.ID }]);
}

function itemTypeExpr() {
return 'employee';
function itemTypeExpr(obj: { type: string; }, value: string) {
if (value === undefined) {
return 'employee';
}
obj.type = value;
return null;
}

function itemCustomDataExpr(obj: Employee, value: Employee) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,12 @@ function onRequestLayoutUpdate(e) {
function deleteEmployee(employee) {
dataSource.push([{ type: 'remove', key: employee.ID }]);
}
function itemTypeExpr() {
return 'employee';
function itemTypeExpr(obj, value) {
if (value === undefined) {
return 'employee';
}
obj.type = value;
return null;
}
function itemCustomDataExpr(obj, value) {
if (value === undefined) {
Expand Down Expand Up @@ -271,7 +275,7 @@ export default function App() {
}
function PopupContentFunc(props) {
return (
<React.Fragment>
<>
<div className="dx-fieldset">
<div className="dx-field">
<div className="dx-field-label">Name</div>
Expand Down Expand Up @@ -362,6 +366,6 @@ function PopupContentFunc(props) {
onClick={props.cancelEditEmployeeClick}
></Button>
</div>
</React.Fragment>
</>
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -186,8 +186,14 @@ const dataSource = new ArrayStore({
const currentEmployee = ref({} as Record<string, any>);
const popupVisible = ref(false);

const itemTypeExpr = () => 'employee';
function itemCustomDataExpr(obj: any, value: any) {
const itemTypeExpr = (obj: { type: string; }, value: string) => {
if (value === undefined) {
return 'employee';
}
obj.type = value;
return null;
};
function itemCustomDataExpr(obj: Employee, value: Employee) {
if (value === undefined) {
return { ...obj };
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,13 @@ $(function () {
nodes: {
dataSource: store,
keyExpr: 'ID',
typeExpr() { return 'employee'; },
typeExpr(obj, value) {
if (value === undefined) {
return 'employee';
}
obj.type = value;
return null;
},
parentKeyExpr: 'Head_ID',
customDataExpr(obj, value) {
if (value === undefined) {
Expand Down
Loading