0

我有一个网格。在双击网格时,我需要获取表格的字段值..

网格代码:

<div class="claro" id="sdsfs" name="dataGrid" onclick="setWidgetproperty(this.id,'xy','inner__sdsfs')" ondblclick="editDataGridResponse(this.id)" onmouseup="setDocStyle(this.id)" style="height: 200px; left: 58px; position: absolute; top: 51px; width: 950px;">
     <table class="claro" dojotype="dojox.grid.DataGrid" id="inner__sdsfs" rowselector="10px" style="height: 95%; width: 95%;">
          <thead>
               <tr>
                    <th field="Column1" width="100px">
                         Column1
                    </th>
                    <th field="Column2" width="100px">
                         Column2
                    </th>
                    <th field="Column3" width="100px">
                         Column3
                    </th>
                    <th field="Column4" width="100px">
                         Column4
                    </th>
                    <th field="Column5" width="100px">
                         Column5
                    </th>
               </tr>
          </thead>
     </table>
     <input id="hidden__sdsfs" name="dataGrid" style="display:none;" type="hidden">
</div>

我尝试了以下功能。但它不工作。

 editDataGridResponse():



function editDataGridResponse(_sgridID){
    var tableID = document.getElementById("inner__"+_sgridID);
    for(var i=0; i<tableID.rows[0].length; i++){
                    alert(tableID.rows[0].field);
                }
   }
4

2 回答 2

0

尝试

function editDataGridResponse(_sgridID){
    var tableID = document.getElementById("inner__"+_sgridID);
    for(var i=0; i<tableID.rows[0].cells.length; i++){
         alert(tableID.rows[0].cells[i].innerHTML);
    }
}
于 2013-04-02T04:18:37.177 回答
0

尝试这个

function editDataGridResponse(_sgridID){
    var tableID = document.getElementById("inner__"+_sgridID);
    if (tableID)
    {
        for (var j= 0; j < tableID.rows.length; j++)
        {
            for(var i=0; i<tableID.rows[j].cells.length; i++){
                        alert(tableID.rows[j].cells[i].field);
                    }
        }
    }
    else
      alert("Table Id " + "inner__"+_sgridID + " Wrong");
  }
于 2013-04-02T04:26:48.233 回答