Hi,
I'm trying to get a grouping drop down list working in a batch edit grid. I am using "e-edit template" to accomplish this. When adding new rows I can get the grouping drop down list to render properly but I have no idea what the "read" function should be.
Here is the code:
<code>
<ej-grid id="FlatGrid" allow-paging="true" enable-alt-row="true" action-failure="failure" allow-keyboard-navigation="true" allow-resizing="true" allow-resize-to-fit="true" create="createGrid">
<e-datamanager url="/Telecom/UsersDataSource" batch-url="/Telecom/UsersBatchUpdate" adaptor="UrlAdaptor" />
<e-edit-settings allow-editing="true" allow-adding="true" allow-deleting="true" edit-mode="@(EditMode.Batch)" show-confirm-dialog="true" show-delete-confirm-dialog="true" />
<e-toolbar-settings show-toolbar="true" toolbar-items="@(new List<string>() {"add","update","cancel" })"></e-toolbar-settings>
<e-columns>
<e-column field="Id" is-primary-key="true" visible="false"></e-column>
<e-column field="SecurityUserId" header-text="User" foreign-key-field="Id" foreign-key-value="FullName" datasource="@users">
<e-edit-template create="create" read="read" write="write">
</e-edit-template>
</e-column>
</e-columns>
</ej-grid>
<script type="text/javascript">
function create() {
return $("<input>");
}
function read(args) {
// this is obviously wrong
var data = args.ejDropDownList("getSelectedValue");
return args.ejDropDownList(data);
}
function write(args) {
//this appears to be working
args.element.ejDropDownList({
width: "100%",
dataSource: args.column[1].dataSource,
watermarkText: "Select a user",
allowGrouping: true,
fields: { text: "FullName", value: "Id", category: "ActiveGrouping" },
value: args.rowdata !== undefined ? args.rowdata["SecurityUserId"] : ""
});
}
</script>
</code>
Thanks!
Chris