I have a grid grouped by sections.
Sections are defined by org_id field which is a part of datasource.
One more field is Regional Code defined by regional_code_id field in datasource.
Grid edit is implemented as a popup editor based on template.
Regional Code is a dropdownlist in popup edit template.
The content of this dropdown in popup template SHOULD DEPEND on section.
So I do following in grid edit event:
edit: function(e) {
console.log('edit event', e.model.ORG_ID);
dsRegionalCode.read({org_id: e.model.ORG_ID});
}
I see in the console that it passes a correct ID of section when requesting data from server and gets a correct data.
First time it works fine in the template and shows a correct Regional Code value in dropdown.
But if I edit a grid record from another section, the Regional Code dropdown doesn't show a correct value.
It shows -- Select Value --
Then second edit click at the same grid record shows a correct value in dropdown.
Looks like it doesn't wait till dsRegionalCodeCode.read() finishes and uses what datasource contains right now, i.e. the content from previous read.
Kendo UI documentation describes one more grid event: beforeEdit.
So I tried following:
beforeEdit: function(e) {
console.log('beforeEdit event', e.model.ORG_ID);
dsRegionalCode.read({org_id: e.model.ORG_ID});
}
But I don't see this message in console log at all. I see 'edit event' only.
Looks like this event doesn't fire when you click edit to open popup editor.
Version of Kendo UI is v2016.2.714
Could you please explain what is a correct way of populating datasource for dropdown in grid popup editor if by design the content of this dropdown depends on a record in a grid and it could vary?
Sections are defined by org_id field which is a part of datasource.
One more field is Regional Code defined by regional_code_id field in datasource.
Grid edit is implemented as a popup editor based on template.
Regional Code is a dropdownlist in popup edit template.
The content of this dropdown in popup template SHOULD DEPEND on section.
So I do following in grid edit event:
edit: function(e) {
console.log('edit event', e.model.ORG_ID);
dsRegionalCode.read({org_id: e.model.ORG_ID});
}
I see in the console that it passes a correct ID of section when requesting data from server and gets a correct data.
First time it works fine in the template and shows a correct Regional Code value in dropdown.
But if I edit a grid record from another section, the Regional Code dropdown doesn't show a correct value.
It shows -- Select Value --
Then second edit click at the same grid record shows a correct value in dropdown.
Looks like it doesn't wait till dsRegionalCodeCode.read() finishes and uses what datasource contains right now, i.e. the content from previous read.
Kendo UI documentation describes one more grid event: beforeEdit.
So I tried following:
beforeEdit: function(e) {
console.log('beforeEdit event', e.model.ORG_ID);
dsRegionalCode.read({org_id: e.model.ORG_ID});
}
But I don't see this message in console log at all. I see 'edit event' only.
Looks like this event doesn't fire when you click edit to open popup editor.
Version of Kendo UI is v2016.2.714
Could you please explain what is a correct way of populating datasource for dropdown in grid popup editor if by design the content of this dropdown depends on a record in a grid and it could vary?