Last active
November 12, 2018 12:29
-
-
Save gregoryagu/c26d948dbec8301d78f6f9a2b069c5dc to your computer and use it in GitHub Desktop.
Key Field Should Be Read Only
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<require from="./Default-Sample.css"></require> | |
<div> | |
<ej-grid id="grid" | |
e-toolbar-settings.bind="toolbar" | |
e-edit-settings.bind="edit" | |
e-data-source.bind="ProjectData" | |
e-on-action-complete.delegate="onActionComplete($event.detail)" | |
> | |
<ej-column e-field="taskID" e-header-text="Task Id" e-is-primary-key="true"> | |
</ej-column> | |
<ej-column e-field="statusID" e-header-text="Status ID" e-allow-editing.bind='false' e-text-align="center"></ej-column> | |
</ej-column> | |
<ej-column e-field="statusName" e-header-text="Status" e-edit-type="dropdownedit" e-edit-params.bind='statusParams' e-text-align="center"></ej-column> | |
</ej-column> | |
</ej-grid> | |
</div> | |
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export class DefaultSample { | |
onActionComplete(event) { | |
console.log("on action completed"); | |
let requestType = event.requestType; | |
console.log(requestType); | |
if (requestType == "save") { | |
console.log(event); | |
let updated = event.data; | |
console.log('New StatusID: ' + updated.statusID);//StatusID is not updated. | |
} | |
} | |
constructor() { | |
this.statusParams = {dataSource:'statusList', fields: { text: 'name', id: 'statusID' } }; | |
this.toolbar = { showToolbar: true, toolbarItems: ['edit', 'update', 'cancel', 'add'] }; | |
this.statusList = [{statusID:1, name:'New'},{statusID:2, name:'Pending'}]; | |
this.edit = { allowEditing: true, allowAdding:true }; | |
this.columns = [ | |
{ field: 'taskID', headerText: 'Task Id', width: '45', isPrimaryKey: true }, | |
{ field: 'taskName', headerText: 'Task Name' }, | |
{ field: 'startDate', headerText: 'Start Date' }, | |
{ field: 'endDate', headerText: 'End Date' }, | |
{ field: 'duration', headerText: 'Duration' }, | |
{ field: 'progress', headerText: 'Progress' } | |
]; | |
this.ProjectData = [ | |
{ | |
taskID: 1, | |
statusID: 1, | |
statusName: 'New', | |
taskName: 'Planning', | |
startDate: '02/03/2014', | |
endDate: '02/07/2014', | |
tags: ['A','B'] | |
}, | |
{ | |
taskID: 2, | |
statusID: 2, | |
statusName:'Pending', | |
taskName: 'Design', | |
startDate: '02/10/2014', | |
endDate: '02/14/2014', | |
tags: ['A','B'] | |
}, | |
{ | |
taskID: 3, | |
statusName: 'New', | |
statusID: 1, | |
taskName: 'Design', | |
startDate: '02/10/2014', | |
endDate: '02/14/2014', | |
}, | |
{ | |
taskID: 4, | |
statusID: 2, | |
statusName: 'Pending', | |
taskName: 'Design', | |
startDate: '02/10/2014', | |
endDate: '02/14/2014', | |
} | |
] | |
} | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ej-tree-grid { | |
display: block; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html xmlns="http://www.w3.org/1999/xhtml"> | |
<head> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<meta name="description" content="Essential Studio for JavaScript"> | |
<meta name="author" content="Syncfusion"> | |
<title>Untitled</title> | |
<!-- Essential Studio for JavaScript theme reference --> | |
<link rel="stylesheet" href="https://cdn.syncfusion.com/14.2.0.28/js/web/flat-azure/ej.web.all.min.css" /> | |
</head> | |
<body aurelia-app="main"> | |
<h1>Loading...</h1> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.19.6/system.js"></script> | |
<script src="https://rawgit.com/aurelia-ui-toolkits/aurelia-syncfusion-bundles/0.0.1/config2.js"></script> | |
<script> | |
System.import('aurelia-bootstrapper'); | |
</script> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export function configure(aurelia) { | |
aurelia.use | |
.standardConfiguration() | |
.developmentLogging() | |
.plugin('aurelia-syncfusion-bridge', syncfusion => syncfusion.useAll()); | |
aurelia.start().then(a => a.setRoot()); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment