2016-05-18 1 views
0

Gijgoグリッドに行を追加しようとしていますが、グリッドにチェックボックスで表示されるブール型フィールドを含む.addRowメソッドがありますが、いくつか問題があります。 AddRowの呼び出し後、グリッドのチェックボックスは常にチェックされません。私は "true/1/checked"を渡すさまざまな方法で試しましたが、結果は同じですが、チェックボックスは選択されていません。Gijgoグリッドのチェックボックスを評価するには?

私は誤解していますか? ありがとうございました

あなたはそれを行うためにcellDataBoundを使用することができます

   grid = $("#grid").grid({ 
        dataSource: datasourceiniziale, 
        dataKey: "Id", 
        uiLibrary: "bootstrap", 
        columns: 
        [ 
         { field: "Id", sortable: false, hidden: true }, 
         { field: "description", title: "Elemento specifico", width: "70%"}, 
         { field: "requtile", title: "Per capacità prof.le", align: 'center', type:"checkbox" }, 
         { width: 34, type: "icon", icon: "glyphicon-remove", tooltip: "Elimina", events: { "click": Delete } } 
        ] 
       }); 


       function Save() { 
        grid.addRow({ 
         'Id': grid.count() + 1, 
         'description': $("#elementospecifico").val(), 
         'requtile' : 'true' //I tried with true/1/checked/on 
        }); 
       } 

答えて

1

ビュー。このイベントの詳細については、http://gijgo.com/Grid/Events/cellDataBound

grid = $("#grid").grid({ 
    dataSource: datasourceiniziale, 
    dataKey: "Id", 
    uiLibrary: "bootstrap", 
    columns:[ 
    { field: "Id", sortable: false, hidden: true }, 
    { field: "description", title: "Elemento specifico", width: "70%"}, 
    { field: "requtile", title: "Per capacità prof.le", align: 'center', type:"checkbox" }, 
    { width: 34, type: "icon", icon: "glyphicon-remove", tooltip: "Elimina", events: { "click": Delete } } 
    ], 
    cellDataBound, function (e, $wrapper, id, column, record) { 
    if ('requtile' === column.field) { 
     $wrapper.find('input[type="checkbox"]').prop("checked", record.requtile); 
    } 
    } 
}); 
+0

Yeppa!...それは非常にうまくいきます...ありがとうAtanas – Charles

関連する問題