I have the following grid:
[editTemplate]="{create:dropCreate, read:dropRead, write:replacedDropWrite}">
[editTemplate]="{create:dropCreate, read:dropRead, write:userDropWrite}">>
[editTemplate]="{create:dropCreate, read:dropRead, write:projectDropWrite}">>
I need the editTemplate because I need to slightly customise my dropdown — to add filterSearch in it. Here's one of the editTemplate 'write' methods:
userDropWrite(args)
console.log(grid)
args.element.ejDropDownList({enableFilterSearch:"true", width: "100%", dataSource: args.column[1].dataSource, fields: { text: "value", value: "value" }, selectedItemIndex:args.rowData != undefined ? args.rowData["userId"] : 0 });
}
The whole problem I have is with selectedItemIndex property. Logically, I want dropdown to have the exact value to be selected, that was selected before. So, if I have a value of 2 in the unedited record, i want "2" to be the dropdown's selected value too. However, that seems not to be possible.
The "rowData" property of the args I could've used to select a proper value, comes undefined always. There's no other properties in the args that could've been used to get the required data. I am not willing to use Jquery in this project to solve the problem that way. So, answer any question of the following:
Why the rowData comes undefined? Is there a way to fix it?
Is there a way to select the value needed without setting the selectedItemIndex?
Or, if editTemplate does not work as intended, is there a way to customise a dropdown that is created by default, without editTemplate?
I will await your answer.