我在这里使用剑道。我的下拉菜单(itemType)包含3个类别: *默认值=库存
以及单选按钮(购买状态)由2种类型组成,即: *默认值= NP
因此,我在这里有2个条件:
if (itemType == "Asset" || itemType == "Inventory"){
//radio button will be NP
}
else if (itemType == "P&L"){
//radio button will be ML
}
JavaScript
fields: {
itemType: {editable: true, defaultValue: "inventory", validation: {required: true} },
purchaseStatus: {editable: true, defaultValue: "NP", validation: {required: true} },
columns: [
{ field: "itemType", title:"Item Type"},
{ field: "purchaseStatus", title:"Purchase Status"},
],
HTML
//Dropdown
<!-- ITEM TYPE -->
<div class="k-edit-label">
<label for="itemType">Item Type</label>
</div>
<select id="itemType" name="itemType" style="width:60%; margin:5px 0px 5px 0px;" data-role="dropdownlist" data-bind="value: value"
<option value="" selected="selected">Choose an option</option>
<option value="inventory">Inventory</option>
<option value="asset">Asset</option>
<option value="P&L">P&L</option>
</select>
//Radio button
<!-- PURCHASE STATUS -->
<div class="k-edit-label">
<label for="purchaseStatus">Purchase Method</label>
</div>
<input class="k-radio" type="radio" name="purchaseStatus" id="NP" value="NP" />
<label class="k-radio-label" style="margin:8px 0px 5px 0px; padding-right:10px;" for="NP" >NP</label>
<input class="k-radio" type="radio" name="purchaseStatus" id="ML" value="ML" />
<label class="k-radio-label" style="margin:8px 0px 5px 0px;" for="ML" >ML</label>
但是,现在我试图工作不佳。任何人都可以证明我是否在这里缺少任何东西?谢谢!