作成日: 2018/03/30 最終更新日: 2018/07/25
文書種別
不具合
状況
修正済み
詳細
FlexGridの横スクロールを操作すると、ブラウザウィンドウの縦スクロールバーがスクロールアップする場合があります。
【再現手順】
1.デモサイトを表示します
http://demo.grapecity.com/c1/aspnet/MvcExplorer/FlexGrid
2.ブラウザのサイズを幅1200ピクセル、高さが600ピクセル程度にします
3.セルA1(1行1列目)を選択します
4.ブラウザの縦スクロールバーを最下部まで移動させます
5.FlexGridの横スクロールバーをドラッグで右端まで移動させ、マウスダウンを維持したまま反対の左端まで移動させます
-- ブラウザの縦スクロールバーがスクロールアップします。
【再現手順】
1.デモサイトを表示します
http://demo.grapecity.com/c1/aspnet/MvcExplorer/FlexGrid
2.ブラウザのサイズを幅1200ピクセル、高さが600ピクセル程度にします
3.セルA1(1行1列目)を選択します
4.ブラウザの縦スクロールバーを最下部まで移動させます
5.FlexGridの横スクロールバーをドラッグで右端まで移動させ、マウスダウンを維持したまま反対の左端まで移動させます
-- ブラウザの縦スクロールバーがスクロールアップします。
回避方法
この問題は2018J v2(4.0.20182.160)で修正されました。
※修正版を適用しない場合の回避方法は以下の通りです。
次のJavaScriptをFlexGridを配置したビュー(*.cshtml)に適用することで回避することが可能です。なお、本回避コードは2018v1のみ適用可能で、それ以前のバージョンでの回避方法はありません。
※回避策(2018J v1用)
------------------------------------------------
<script>
var _supportsFocusOptions = false;
document.createElement('div').focus({
get preventScroll() {
_supportsFocusOptions = true;
return true;
}
});
function supportsFocusOptions() {
return _supportsFocusOptions;
}
wijmo.supportsFocusOptions = supportsFocusOptions;
wijmo.grid.FlexGrid.prototype._setFocus = function (force) {
if (this.hostElement) {
if (force || !this.containsFocus()) {
var ae = wijmo.getActiveElement(), aedt = this.activeEditor,
acell = this._activeCell, efocus = this._eFocus,
ti = 'tabindex';
if (aedt) {
if (!wijmo.contains(aedt, ae)) {
aedt.focus();
efocus.removeAttribute(ti);
}
}
else if (acell) {
if (!wijmo.contains(acell, ae)) {
if (ae != this._root) {
var done = false;
if (wijmo.isIE()) {
this._setFocusNoScroll(acell);
done = true;
}
if (!done) {
acell.tabIndex = this._tabIndex;
acell.focus();
}
efocus.removeAttribute(ti);
}
}
}
else {
if (!wijmo.contains(efocus, ae) && ae != this._root) {
efocus.tabIndex = this._tabIndex;
efocus.focus();
}
}
if (!this.containsFocus()) {
efocus.tabIndex = this._tabIndex;
efocus.focus();
}
}
}
};
wijmo.grid.FlexGrid.prototype._setFocusNoScroll = function (e) {
e.tabIndex = this._tabIndex;
if (wijmo.supportsFocusOptions()) {
e.focus({
preventScroll: true
});
}
else {
var sp = this.scrollPosition, st = e.style, pos = st.position;
st.position = 'fixed';
e.focus();
st.position = pos;
this.scrollPosition = sp;
}
this._fixScroll();
};
wijmo.grid.FlexGrid.prototype._fixScroll = function () {
var host = this.hostElement, rootParent = this._root ? this._root.parentElement : null;
[host, rootParent].forEach(function (e) {
if (e && e.scrollTop)
e.scrollTop = 0;
});
};
</script>
------------------------------------------------
※修正版を適用しない場合の回避方法は以下の通りです。
次のJavaScriptをFlexGridを配置したビュー(*.cshtml)に適用することで回避することが可能です。なお、本回避コードは2018v1のみ適用可能で、それ以前のバージョンでの回避方法はありません。
※回避策(2018J v1用)
------------------------------------------------
<script>
var _supportsFocusOptions = false;
document.createElement('div').focus({
get preventScroll() {
_supportsFocusOptions = true;
return true;
}
});
function supportsFocusOptions() {
return _supportsFocusOptions;
}
wijmo.supportsFocusOptions = supportsFocusOptions;
wijmo.grid.FlexGrid.prototype._setFocus = function (force) {
if (this.hostElement) {
if (force || !this.containsFocus()) {
var ae = wijmo.getActiveElement(), aedt = this.activeEditor,
acell = this._activeCell, efocus = this._eFocus,
ti = 'tabindex';
if (aedt) {
if (!wijmo.contains(aedt, ae)) {
aedt.focus();
efocus.removeAttribute(ti);
}
}
else if (acell) {
if (!wijmo.contains(acell, ae)) {
if (ae != this._root) {
var done = false;
if (wijmo.isIE()) {
this._setFocusNoScroll(acell);
done = true;
}
if (!done) {
acell.tabIndex = this._tabIndex;
acell.focus();
}
efocus.removeAttribute(ti);
}
}
}
else {
if (!wijmo.contains(efocus, ae) && ae != this._root) {
efocus.tabIndex = this._tabIndex;
efocus.focus();
}
}
if (!this.containsFocus()) {
efocus.tabIndex = this._tabIndex;
efocus.focus();
}
}
}
};
wijmo.grid.FlexGrid.prototype._setFocusNoScroll = function (e) {
e.tabIndex = this._tabIndex;
if (wijmo.supportsFocusOptions()) {
e.focus({
preventScroll: true
});
}
else {
var sp = this.scrollPosition, st = e.style, pos = st.position;
st.position = 'fixed';
e.focus();
st.position = pos;
this.scrollPosition = sp;
}
this._fixScroll();
};
wijmo.grid.FlexGrid.prototype._fixScroll = function () {
var host = this.hostElement, rootParent = this._root ? this._root.parentElement : null;
[host, rootParent].forEach(function (e) {
if (e && e.scrollTop)
e.scrollTop = 0;
});
};
</script>
------------------------------------------------
旧文書番号
82595