编程dojox.grid.DataGrid上的水平滚动条

编程dojox.grid.DataGrid上的水平滚动条,dojo,dojox.grid.datagrid,Dojo,Dojox.grid.datagrid,如何防止水平滚动条显示 我正在尝试的一个例子是 下面是我尝试做的一个示例页面。当容器div的宽度设置为大于网格宽度时,我希望不会显示水平滚动条 使用当前高度200px且行数大于6时,将显示垂直方向(良好)。但是,水平方向也会显示(错误) 我错过了什么 谢谢 fdl 网格滚动 require(“dojo.store.Memory”); require(“dojo.data.ObjectStore”); require(“dojox.grid.DataGrid”); dojo.ready(函数()

如何防止水平滚动条显示

我正在尝试的一个例子是

下面是我尝试做的一个示例页面。当容器div的宽度设置为大于网格宽度时,我希望不会显示水平滚动条

使用当前高度200px且行数大于6时,将显示垂直方向(良好)。但是,水平方向也会显示(错误)

我错过了什么

谢谢

fdl


网格滚动
require(“dojo.store.Memory”);
require(“dojo.data.ObjectStore”);
require(“dojox.grid.DataGrid”);
dojo.ready(函数(){
var myStore=new dojo.store.Memory({
数据:[{id:“RecId1”,值:“fooValue1”},
{id:“RecId2”,值:“fooValue2”},
{id:“RecId3”,value:“fooValue3”},
{id:“RecId4”,value:“fooValue4”},
{id:“RecId5”,value:“fooValue5”},
{id:“RecId6”,value:“fooValue6”},
{id:“RecId7”,value:“fooValue7”},
{id:“RecId7”,value:“fooValue7”}]
});
dataStore=new dojo.data.ObjectStore({
objectStore:myStore
});
var grid=new dojox.grid.DataGrid({
存储:数据存储,
结构:[{
姓名:“ID”,
字段:“id”,
宽度:“100px”
}, {
名称:“值”,
字段:“值”,
宽度:“100px”
}]
}“myGrid”);
grid.startup();
});

将此样式替代添加到头部元素:

<style>
  .dojoxGridScrollbox { overflow-x: hidden; }
</style>

非常感谢。这起作用了。我只是认为我创建的网格是错误的,或者调用的启动是错误的,因为网格(按大小)不应该有水平滚动。进一步的尝试表明,如果我将网格放在完整页面bordercontainer的中心窗格中,则在初始页面加载时会显示水平滚动条,但浏览器窗口的任何大小调整都会导致滚动条消失。当然,这个尝试是在我添加您推荐的样式之前完成的。必须与.resize()触发的时间有关。再次感谢你的帮助。fdlidd您说得对,调整大小后,bordercontainer布局会在其所有子项上调用resize-如果子项具有任何此类功能,我只希望了解如何使初始页面加载时发生的调整大小正确隐藏水平滚动。加载页面,然后用户更改浏览器窗口后触发的调整大小操作确实正确地隐藏了水平方向。请检查此文件:/dojo-release-1.7.2-src/dojox/grid/_grid.js:685这看起来很臭,但我添加了setTimeout(函数(){grid.resize();},1);渲染栅格后,水平面将隐藏。再次感谢你的帮助。
<style>
  .dojoxGridScrollbox { overflow-x: hidden; }
</style>
            resize: function(changeSize, resultSize){
                    // summary:
                    //              Update the grid's rendering dimensions and resize it

                    // Calling sizeChange calls update() which calls _resize...so let's
                    // save our input values, if any, and use them there when it gets
                    // called.  This saves us an extra call to _resize(), which can
                    // get kind of heavy.

                    // fixes #11101, should ignore resize when in autoheight mode(IE) to avoid a deadlock
                    // e.g when an autoheight editable grid put in dijit.form.Form or other similar containers,
                    // grid switch to editing mode --> grid height change --> From height change
                    // ---> Form call grid.resize() ---> grid height change  --> deaklock
                    if(dojo.isIE && !changeSize && !resultSize && this._autoHeight){
                            return;
                    }
                    this._pendingChangeSize = changeSize;
                    this._pendingResultSize = resultSize;
                    this.sizeChange();
            },