LoginSignup
0
0

Grid内ボタン

Last updated at Posted at 2024-04-10
var flexGrid = new wijmo.grid.FlexGrid('#FlexGrid');
flexGrid.itemsSource = createData(10);

flexGrid.columns[0].isReadOnly = true;
flexGrid.columns[0].width = 180;
flexGrid.columns[1].isReadOnly = true;
flexGrid.columns[1].width = 180;

flexGrid.itemFormatter = function (panel, r, c, cell) {
    if (panel.cellType == wijmo.grid.CellType.Cell) {
        if (c == 0) {
            cell.innerHTML = '<div style="text-align: center;"><input type="button" value="ボタン1" onmousedown="alert(' + "'ボタン1'" + ');" style="margin: -3px;" /></div>';
        }
        else if (c == 1) {
            cell.innerHTML = '<div style="text-align: center;"><input type="button" value="ボタン2" onclick="alert(' + "'ボタン2'" + ');" style="margin: -3px;" /></div>';
        }
    }
}

flexGrid.selectionChanging.addHandler(function (s, e) {
    if (e.col == 1) {
        e.cancel = true;
    }
});

function createData(count) {
    var data = [];

    for (var i = 0; i < count; i++) {
        data.push({
            mousedownイベント: '',
            セル選択させない: ''
        });
    }

    return data;
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0