When adding a new item to a Kendo Grid using inline editing, the ContractID
datasource is filtered by the selected OrgID
. Once a row has been added, the OrgID
column is no longer editable (set using isOrgEditable()
) but the ContractID
is. Unfortunately the cascade doesn't then work for editing and the datasource for ContractID
is unfiltered.
To resolve that issue I subscribe to the edit event (data-edit="setContractsDataSource"
) and filter the data source manually. That works but then the Update button doesn't do anything and the edit is lost.
<div id="grid">
<div class="k-content wide">
<div>
<div data-role="grid"
data-editable="inline"
data-edit="setContractsDataSource"
data-toolbar="[{ name: 'create', text: 'Add Item' }]"
data-columns='[
{ field: "OrgID", title: "Company", editable: isOrgEditable, editor: orgDropDownEditor, template: "#: lookupForOrg(organisationID) #" },
{ field: "ContractID", title: "Contract", editor: contractsDropDownEditor, template: "#: lookupForContract(ContractID) #" },
{ command: ["edit", "destroy"], width: "220px" }
]'
data-sortable="true"
data-pageable="true"
data-filterable="true"
data-bind="source: items"></div>
</div>
</div>
</div>