Hi I have a grid that that I am trying to implement inline editing for. I have a list of courses, each course has a Tearcher and a Teacher Assistant that are assigned to it.
Here is what my grid looks like (Teacher and Assistant, have additional properties like Tearcher.ResourceId, the key, Teacher.Name (obtained from the account id) and Teacher.AccountId
"<ejs-grid id="course-teacher" allowfiltering="true" width="100%" allowpaging="true" toolbar="@(new List<string>() { " edit",="" "cancel",="" "update"="" })"=""></ejs-grid></p><p>
<e-data-manager json="@Model.Course.ToArray()" adaptor="RemoteSaveAdaptor" updateurl="@Url.Action(" updateteacher",="" "syncfusion",="" new="" {="" area="" })"=""></e-data-manager></p><p><e-grid-filtersettings type="Menu"></e-grid-filtersettings></p><p><e-grid-editsettings allowediting="true"></e-grid-editsettings></p><p> <e-grid-columns></e-grid-columns></p><p><e-grid-column field="Course" allowediting="false" allowsorting="false" type="string" headertext="Name" width="140"></e-grid-column></p><p><e-grid-column field="Teacher.Name" edittype="dropdownedit" type="string" allowsorting="false" headertext="Teacher" width="200"></e-grid-column>"
When I click on the inline edit drop down and change the value of the Teacher or Assistant name and I post this to be saved, only the Name is actually updated, it does not update the account Id which I need to use to update my database. The question is, how do I get the Teacher.AccountId update posted rather than just the Teacher.Name property.
Thank you in advance
|
<ejs-grid id="course-teacher" allowfiltering="true" width="100%" allowpaging="true" toolbar="@(new List<string>() { " edit","cancel","update"}) load="load" actionBegin="actionBegin">
. . .
<e-grid-column field="Teacher.Name" headerText="Order Date" edit=dpParams editType="dropdownedit" width="150"></e-grid-column>
. . .
</ejs-grid>
<script>
fun
var id;
function load(){
var grid = document.getElementById('course-teacher').ej2_instances[0];
grid.getColumnByField("Teacher.Name").edit = {params:{
query: new ej.data.Query().select(['Teacher.AccountId', 'Teacher.Name']),
change: (e) => {
id = e.itemData['Teacher']['AccountId'];
},
}}
}
function actionBegin (e) {
if (e.requestType == 'save') {
e.data['Teacher']['AccountId'] = id || e.data['Teacher']['AccountId'];
id = null;
}
},
</script> |