2016-06-20 21 views
1

javascriptベースのチェックボックスを作成しようとしていますが、どうにかして動作させることができません。以前は質問を作成しましたが、コメントに自分のコードを追加することができず、新しい質問ができました。これは私がしたことです:JavascriptとDhtmlxでチェックボックスを作成する

function eXcell_includeDC(cell) { 
    if (cell){   // the default pattern, just copy it 
     this.cell = cell; 
     this.grid = this.cell.parentNode.grid; 
    } 
    this.getValue = regExpGetValueCell; 

    if (this.getValue = 'Y') { 
     var myDiv = document.getElementById("includeDC"); 
     var checkbox = document.createElement("input"); 
     checkbox.setAttribute("type", "checkbox"); 
     checkbox.setAttribute("name", "dd"); 
     checkbox.setAttribute("value", "ff"); 
     checkbox.checked = true; 
     myDiv.appendChild(checkbox); 
     checkbox.checked = true; 
    } else { 
     var myDiv = document.getElementById("includeDC"); 
     var checkbox = document.createElement("input"); 
     checkbox.setAttribute("type", "checkbox"); 
     checkbox.setAttribute("name", "dd"); 
     checkbox.setAttribute("value", "ff"); 
     checkbox.checked = true; 
     myDiv.appendChild(checkbox); 
     checkbox.checked = false; 
    } 
    this.isDisabled = function() { 
     return true; 
    } 
    this.setValue=function(val) { 
     // actual data processing may be placed here, for now we just set value as it is 
     this.setCValue(val); 
    } 
} 
eXcell_includeDC.prototype = new eXcell; 

答えて

2

セルに表示する必要があるすべてのHTMLコンテンツをsetValue関数で作成する必要があります。 ここに簡略化した例を示します。

function eXcell_includeDC(cell){ //the eXcell name is defined here 
    if (cell){    // the default pattern, just copy it 
     this.cell = cell; 
     this.grid = this.cell.parentNode.grid; 
    } 
    this.edit = function(){} //read-only cell doesn't have edit method 
    // the cell is read-only, so it's always in the disabled state 
    this.isDisabled = function(){ return true; } 
    this.setValue=function(val){ 
     if (val=="Y") 
     this.setCValue("<input type='checkbox' checked='checked/>",val); 
     else 
     this.setCValue("<input type='checkbox'/>",val); 
    } 
} 
eXcell_includeDC.prototype = new eXcell; 
+0

恐ろしいです!これは大きな助けとなりました! :) –

関連する問題