嗨,我有一个包含国家和州详细信息的剑道网格。我有一个带有添加按钮的工具栏。当我单击添加新按钮时,我会弹出一个带有国家和州下拉菜单的弹出窗口。现在我想选择国家然后状态。但在这里我想根据国家选择加载状态。这是我的示例代码。它不工作。
function loadStates(element) {
// here I want to update below model
StateModel.StatesByCountry
something like this.
StateModel.LoadStatesByCountry($(element).val(), function () {
});
}
<script id="popup_editor" type="text/x-kendo-template">
<div class="k-edit-label">
<label for="Country">Country</label>
</div>
<input name="CntryName"
data-bind="value:CntryName"
data-value-field="Value"
data-text-field="Text"
data-source= CountryModel.AllCountries
data-role="dropdownlist"
onChange="loadStates(this)"
/>
<div class="k-edit-label">
<label for="State">State</label>
</div>
<input name="StateName"
data-bind="value:StateName"
data-value-field="StateID"
data-text-field="StateName"
data-source=StateModel.StatesByCountry
data-role="dropdownlist" />
</script>