我正在使用新的MVC3 WebGrid。到目前爲止很好,只是有問題的樣式/格式化列標題。我得到的最好的解決方法是將WebGrid的第一行應用於表頭的相同css類。MVC3 WebGrid格式或造型列標題
var headerCells = $("#grid tr:eq(0) th");
var firstRowCells = $("#grid tr:eq(1) td");
$.each(firstRowCells, function (index, value) {
$(headerCells[index]).addClass($(firstRowCells[index]).attr("class"));
});
這個例子明顯缺乏檢查,以確保有行或確實爲指定的元素ID,但它從第一行應用的CSS類的標題行這意味着你可以彼此獨立的風格。
td.my-column-style { width:100px }
th.my-column-style { text-align:right;}
是否有內置的樣式化列標題元素(不僅僅是使用headerStyle屬性)?
感謝,這似乎相當有限,不是嗎? – sambomartin 2011-02-06 22:24:47
聽到這個很難過...... – Jason 2011-02-17 03:07:49