作成日: 2026/10/15 最終更新日: 2026/10/15
文書種別
不具合
状況
現象確認済み
詳細
固定列の合計幅がグリッド幅を超えている場合、固定列をドラッグしてサイズ変更した際、マウスを離した直後にデフォルトの幅に戻ります。
回避方法
以下のコードをグリッド生成後に呼び出します。
function initialized(grid) {
if (!grid) return;
let downX = 0;
let drag = null;
let onUp = null;
const host = grid.hostElement;
host.addEventListener(
'mousedown',
function (e) {
drag = null;
downX = e.pageX;
onUp = function (ev) {
if (drag) {
const col = grid.columns.getColumn(drag.col);
drag.desired = Math.max(
col.minWidth || 0,
Math.round(drag.startWidth + (ev.pageX - downX))
);
}
window.removeEventListener('mouseup', onUp, true);
onUp = null;
};
window.addEventListener('mouseup', onUp, true);
},
true
);
grid.resizingColumn.addHandler(function (s, e) {
if (e.panel !== s.cells || !s.columns.isFrozen(e.col)) {
return;
}
if (!drag) {
drag = {
col: e.col,
startWidth: s.columns.getColumn(e.col).renderWidth
};
}
const data = e.data;
if (data && data.maxSize != null) {
data.maxSize = null;
}
});
grid.resizedColumn.addHandler(function (s, e) {
if (e.panel !== s.cells || !drag || e.col !== drag.col) {
return;
}
const d = drag;
queueMicrotask(function () {
if (d.desired == null) {
return;
}
const col = s.columns.getColumn(d.col);
if (col.width !== d.desired) {
col.width = d.desired;
}
});
});
}