2012-04-04 47 views
2

我想將colspan屬性應用於JQgrid模式窗口內的td。它使得結構如下Jqgrid Modal Colspan

<form ...> 
    <table ...> 
    <tbody> 
     <tr ...> 
     <td class="CaptionTD"></td> 
     <td class="DataTD"></td> 
     <td class="CaptionTD"></td> 
     <td class="DataTD"></td> 
     </tr> 
    </tbody> 
    </table> 
</form> 

我看了所有可用的options模式窗體,但我對如何一個跨度屬性適用於任何對TD的不清。我正在閱讀將單元格樣式添加到單元格中,例如使用「類」選項,但據我所知(基於我的研究...如果可以調用它)不能使用CSS設置表的colspan因爲它不是一種風格,而是一種「表格結構變化」

回答

3

您是否使用rowposcolpos屬性formoptions並且喜歡隱藏第二個標籤列?您能否提供一個代碼示例,說明colspan在哪種情況下會很好?

一般來說,您可以在beforeShowForm回調中設置colspan屬性。如果您在<td>設置colspan=2然後一個隱藏在同一行中一些以前<td>元素可以使用類似

// in the below example the column name is 'name' 
$("#tr_name>td:eq(1)").attr("colspan", "2"); 
$("#tr_name>td:eq(1)>input").css("width", "95%"); 
$("#tr_name>td:eq(0)").hide(); 

或類似

beforeShowForm: function() { 
    var $tr = $("#tr_name"), // 'name' is the column name 
     $label = $tr.children("td.CaptionTD"), 
     $data = $tr.children("td.DataTD"); 
    $data.attr("colspan", "2"); 
    $data.children("input").css("width", "95%"); 
    $label.hide(); 
} 

典型。

其結果是可以得到類似

enter image description here