EJ2 Grid childGrid dropdownedit can not Bind to Grid Array

Hierarchical Child Grid DropDown change Value not assign to grid['currentViewData'].. Anyone can Help?





<ejs-grid
#grid2
[(dataSource)]="containerdata"
[childGrid]="childGrid"
[editSettings]="editSettings"
[toolbar]="toolbar"
>
<e-columns>
<e-column
field="section"
headerText="Section"
[allowEditing]="false"
>e-column>
<e-column
field="plant"
headerText="Plant Code"
[allowEditing]="false"
>e-column>
<e-column
field="policy"
headerText="Policy"
[validationRules]="policyRules"
editType="dropdownedit"
[edit]="stateParams"
>e-column>
e-columns>
ejs-grid>

child_grid() {
//console.log(data[0]);
this.childGrid = {
dataSource: this.lineDatas,
queryString: 'section',

editSettings: {
allowEditing: true,
allowAdding: true,
allowDeleting: true,
mode: 'Normal',
newRowPosition: 'Bottom',
},
pageSettings: { pageSize: 6, pageCount: 5 },
toolbar: ['Update', 'Cancel'],
columns: [
{
field: 'workCenter',
headerText: this.translateService.instant('pics.workcenter'),
textAlign: 'Left',
allowEditing: false,
//width: 400,
},
{
field: 'policy',
headerText: this.translateService.instant('pics.Policy'),
textAlign: 'Left',
editType: 'dropdownedit',
edit: {
params: {
allowFiltering: true,
dataSource: new DataManager(this.state),
fields: { text: 'dispaly_code', value: 'dispaly_code' },
change: (data: any) => {
},
query: new Query(),
actionComplete: () => false,
},
},
//width: 400,
},
],
};
}

when click add button changes not view on the grid current array

Parent POLICY Drop Down Data Bind to array correctly... But Child Grid Changes not Updated

onAdd() {
this.grid2.endEdit();

//this.grid2.dataBind();
console.log(this.grid2);
console.log(this.grid2.childGrid);
console.log(this.grid2['currentViewData']);

}


[

{

"sbu": "002",

"plant": "NARA",

"section": "A",

"policy": "Policy_001_30_August_2021_V000",

"details": [

{

"policy": "Policy_001_30_August_2021_V000",

"workCenter": "WC 1A",

"section": "A",

"plant": "NARA"

},

{

"policy": "Policy_001_30_August_2021_V000",

"workCenter": "WC 2A",

"section": "A",

"plant": "NARA"

}

]

},

{

"sbu": "002",

"plant": "NARA",

"section": "B",

"policy": "Policy_001_30_August_2021_V000",

"details": [

{

"policy": "Policy_001_30_August_2021_V000",

"workCenter": "WC 2B",

"section": "B",

"plant": "NARA"

},

{

"policy": "Policy_001_30_August_2021_V000",

"workCenter": "WC 3B",

"section": "B",

"plant": "NARA"

},

{

"policy": "Policy_001_30_August_2021_V000",

"workCenter": "WC 1B",

"section": "B",

"plant": "NARA"

}

]

}

]


1 Reply

RR Rajapandi Ravi Syncfusion Team September 2, 2021 03:36 PM UTC

Hi Tharindu, 

Greetings from syncfusion support 

From your update, we could see that you are using a cell edit params in Child Grid and facing a problem of saved records was not updated in the Grid inbuilt methods. From validating your shared code, we found that you are not maintaining a primaryKey column in your Grid. By default, all the CRUD actions in EJ2 Grid are performed based on the primary key. So, we suggested you set isPrimaryKey as true in any one of unique column. Refer to the below code example and documentation for more information. 

 
this.childGrid = { 
            dataSource: orderDatas, 
            queryString: 'EmployeeID', 
            toolbar: ['Add', 'Edit', 'Delete', 'Update', 'Cancel'], 
            editSettings: { allowEditing: true, allowAdding: true, allowDeleting: true, mode: 'Normal' }, 
            allowPaging: true, 
            pageSettings: {pageSize: 6, pageCount: 5}, 
            columns: [ 
                { field: 'OrderID',  isPrimaryKey: true, headerText: 'Order ID', textAlign: 'Right', width: 120 }, 
                { field: 'ShipCity', headerText: 'Ship City',editType: 'dropdownedit', width: 120, edit: { params: { allowFiltering: true } }}, 
                { field: 'Freight', headerText: 'Freight', width: 120 }, 
                { field: 'ShipName', headerText: 'Ship Name', width: 150 } 
            ] 
        }; 
 



primaryKey: 


If you are using Crud actions in parent Grid, you must maintain a primaryKey column for that parent Grid. 

Regards, 
Rajapandi R 


Loader.
Up arrow icon