2016-10-25 8 views
0

私は剣道グリッドで1つの列を編集する必要があるという要件に取り組んでいます。しかし、ここでグリッドには条件に基づいて表示される列があります。問題は、列を編集するときに非表示列で始まることです。MVVM剣道グリッドの特定の列を編集する方法は?

enter image description here

項目欄を編集した後、それは、AreSkusInUse列を示しています。私のMVVMコードがここ enter image description here

:こちらを

<div id="BomEditorGrid" 
class="" 
data-role="grid" 
data-resizable="true" 
data-sortable="false" 
data-filterable='{ "extra":false, "operators": { "string": { "contains":"Contains", "doesnotcontain" : "Does not contain", "startswith":"Starts with", "endswith": "Ends with", "eq": "Equal to", "neq" : "Not equal to" } }}' 
data-bind="source: bomEditorDataSource" 
data-editable='{"mode": "incell", "template": kendo.template($("#bomEditorEditTemplate").html()) }' 
data-row-template="bomEditorRowTemplate" 
data-alt-row-template="bomEditorAltRowTemplate" 
data-columns='[ 
{"field": "Selected", "title": "Selected", "filterable": false , "sortable": false, "headerTemplate": kendo.template($("#gridHeaderWithCheckboxTemplate").html()), width: 100}, 
{"field": "AreSkusInUse", "title": "SKUs In Use", hidden: true}, 
{"field": "ItemCd", "title": "Item Code"}, 
{"field": "DesignItemNm", "title": "Item"}, 
{"field": "ChildQty", "title": "Child Qty", "filterable": false, width: 100}, 
{"field": "TemplateDsc", "title": "Template"}, 
{"field": "ParentItemNm", "title": "Parent", hidden: true}, 
{"field": "CreatedByBookNm", "title": "Created By"}, 
{"field": "MaterialTypeCd", "title": "Material Type", hidden: true, "template": kendo.template($("#MaterialTypeColumnTemplate").html())}, 
{"field": "DesignGroup", "title": "DesignGroup", hidden: true}, 
{"field": "CrudType", "title": "Change", "filterable": false} 
]'> 

は、エディタのテンプレートです:

<script id="bomEditorEditTemplate" type="text/x-kendo-tmpl"> 
<tr data-uid='#= uid #'> 
    <td><input type="checkbox" class="cb-itemSelected" data-bind='checked:Selected' /></td> 
    # if (BomEditorType === "PFAM") {# 
    <td>#: AreSkusInUse #</td> 
    #}# 
    <td>#: ItemCd #</td> 
    <td>#: DesignItemNm #</td> 
    <td><input type="text" data-bind="value: ChildQty" /></td> 
    # if (MaterialTypeCd !== "DIEN" && MaterialTypeCd !== "FERT") {# 
    <td>#: TemplateDsC#</td> 
    #}# 
    <td>#: CreatedByBookNm #</td> 
    # if (BomEditorType === "FERT") {# 
    <td>#: MaterialTypeCd #</td> 
    #}# 
    <td> <img data-bind="attr:{ class: ChangeIndicatorCssClass}" src="/5/DesignItem/Content/Images/Transparent.gif" /> </td> 
</tr> 

は、ここでは、 AreSkusInUse列が条件に基づいて表示されて見ることができます。

したがって、私は2つの助けが必要です:
Child Qty以外のすべての列を編集可能にするにはfalse。
どうすれば編集問題を解決できますか?編集時には、それぞれのデータを表示する必要があります。

はあなたが編集可能にフィールドを設定するためのスキーマを設定することができます
「子ども数量以外のすべての列が偽編集可能できるようにする方法」

答えて

1
  1. ありがとう:偽

    ItemCd: { type: "string", editable: false } 
    
  2. "編集の問題を解決するにはどうすればいいですか?編集するときは、それぞれのデータを表示する必要があります。

    <tr data-uid='#=uid#'> 
        <td> 
        <input type="number" value="#:ChildQty#" data-bind="value: ChildQty"> 
        </td> 
    </tr> 
    
テンプレート内のフィールドの値を指定します
関連する問題