作成日: 2017/02/02 最終更新日: 2018/02/06
文書種別
使用方法
詳細
ItemFormatterプロパティを使用して下記のようなコードを実装することで、特定のセルの場合にのみ背景色を変更することができます。
◎サンプルコード(View)
◎サンプルコード(View)
<script type="text/javascript">
function itemFormatter(panel, r, c, cell) {
//色のリセット
cell.style.backgroundColor = "";
//特定のセルインデックスの場合に色を変更する
if (r == 2 && c == 2) {
cell.style.backgroundColor = "Red";
}
//セルの値が特定の値の場合に色を変更する
if (panel.columns[c].binding === "Product") {
if (panel.cellType === wijmo.grid.CellType.Cell) {
var text = panel.rows[r].dataItem.Product;
if (text === "Wijmo 5") {
cell.style.backgroundColor = "LightBlue"
}
}
}
}
</script>
@(Html.C1().FlexGrid<Sale>()
・・・
.ItemFormatter("itemFormatter")
)
function itemFormatter(panel, r, c, cell) {
//色のリセット
cell.style.backgroundColor = "";
//特定のセルインデックスの場合に色を変更する
if (r == 2 && c == 2) {
cell.style.backgroundColor = "Red";
}
//セルの値が特定の値の場合に色を変更する
if (panel.columns[c].binding === "Product") {
if (panel.cellType === wijmo.grid.CellType.Cell) {
var text = panel.rows[r].dataItem.Product;
if (text === "Wijmo 5") {
cell.style.backgroundColor = "LightBlue"
}
}
}
}
</script>
@(Html.C1().FlexGrid<Sale>()
・・・
.ItemFormatter("itemFormatter")
)
旧文書番号
81961