ExtJS-autoScroll不';在嵌套网格中不显示
在过去的24小时里,我一直在试图找到这个问题的答案,但找不到解决这个问题的方法。这是: 我将MVC架构与ExtJS4结合使用。我有一个选项卡面板,其中有一些网格作为项目。当这些网格加载时,它们没有垂直滚动条,即使我将autoScroll设置为“true”,并且它们的内容比屏幕显示的内容大。我读到的关于这个问题的每一篇文章都解决了,将网格的父布局设置为“适合”,但是,正如您在下面看到的,我已经完成了,仍然没有滚动条。。。如果我定义了网格的高度,滚动条可以很好地工作,但我需要它以不同的高度工作。。。 我相信我可能有一个过度嵌套的问题,但我几天前才开始用ExtJS开发,它仍然让我有点困惑 问题是:如何使此结构与autoScroll一起工作 所以不让我在这里发布图片,因为我的声誉低于10 请注意,我在图片中写了“布局:'fix'”,但我的意思是“布局:'fit'”) 这是我的主视图,它有两个面板。“中间”是我加载带有网格的选项卡面板的地方ExtJS-autoScroll不';在嵌套网格中不显示,extjs,autoscroll,Extjs,Autoscroll,在过去的24小时里,我一直在试图找到这个问题的答案,但找不到解决这个问题的方法。这是: 我将MVC架构与ExtJS4结合使用。我有一个选项卡面板,其中有一些网格作为项目。当这些网格加载时,它们没有垂直滚动条,即使我将autoScroll设置为“true”,并且它们的内容比屏幕显示的内容大。我读到的关于这个问题的每一篇文章都解决了,将网格的父布局设置为“适合”,但是,正如您在下面看到的,我已经完成了,仍然没有滚动条。。。如果我定义了网格的高度,滚动条可以很好地工作,但我需要它以不同的高度工作。。。
Ext.define('MyApp.view.Main', {
extend: 'Ext.container.Container',
requires:[
// 'Ext.tab.Panel',
// 'Ext.layout.container.Border',
'MyApp.view.Menus'
],
xtype: 'app-main',
layout: {
type: 'border'
},
items: [
{
region: 'north',
xtype: 'panel',
padding: '5 5 0 5',
title: 'MyApp',
items: {
xtype: 'menus'
}
},
{
region: 'center',
itemId: 'centerPanel',
xtype: 'panel',
padding: 5,
layout: 'fit'
}
]
});
这是将字段集和选项卡面板作为项目的视图:
Ext.define('MyApp.view.licencas.List', {
extend: 'Ext.form.Panel',
xtype: 'licencaslist',
title: 'Licenças de software',
border: false,
items: [
{
xtype: 'fieldset',
title: 'Dados do Veículo',
margin: 5,
items: [
{
xtype: 'combobox',
anchor: '100%',
valueField: 'id',
displayField: 'descricao',
store: 'ComboEmpresas',
typeAhead: true,
queryMode: 'local',
name: 'empresa',
fieldLabel: 'Empresa'
},
{
xtype: 'combobox',
editable: false,
valueField: 'id',
displayField: 'descricao',
store: 'ComboSoftwares',
queryMode: 'local',
name: 'software',
fieldLabel: 'Software'
},
{
name: 'valor',
fieldLabel: 'Valor empresa:',
xtype: 'numberfield',
minValue: 0,
maxValue: 100000,
allowDecimals: true,
disabled: true,
},
{
name: 'contrato',
fieldLabel: 'Contrato:',
xtype: 'textfield',
disabled: true,
},
{
name: 'demonstracao',
xtype: 'checkbox',
fieldLabel: 'Demonstração',
disabled: true,
}
]
},
{
xtype: 'licencastabpanel',
border: false,
margin: 5
}
],
initComponent: function() {
this.callParent(arguments)
}
});
最后这是我需要autoScroll属性的网格
Ext.define('MyApp.view.licencas.placas.List', {
extend: 'Ext.grid.Panel',
xtype: 'licencasplacaslist',
store: 'EmpresaVeiculos',
border: false,
forceFit: true,
autoScroll: true,
plugins: [new Ext.grid.plugin.CellEditing({
clicksToEdit: 1,
})],
dockedItems: [
{
dock: 'top',
xtype: 'toolbar',
items: [
{
text: 'Alterar todos',
iconCls: 'money-16',
action: 'alterartodos',
xtype: 'button'
},
'->',
{
xtype: 'trigger',
name: 'searchfieldLicencasPlacas',
itemId: 'searchfieldLicencasPlacas',
emptyText: 'Filtrar por placa...',
width: '500px',
hideLabel: true,
selectOnFocus: true,
triggerCls: 'x-form-search-trigger'
}
]
}
],
columns: [
Ext.create('Ext.grid.RowNumberer'),
{
text: "Placa",
dataIndex: 'placa',
width: 70
},
{
text: "Serial",
dataIndex: 'serial',
width: 70
},
{
text: "Condutor",
dataIndex: 'condutor'
},
{
text: "Ativo",
dataIndex: 'ativo',
width: 50
},
{
text: "Data Início",
dataIndex: 'data_inicio',
format: 'd.m.Y',
width: 60
},
{
text: "Data Fim",
dataIndex: 'dt_fim',
format: 'd.m.Y',
width: 60,
editor: {
xtype: 'datefield',
format: 'd.m.Y'
}
},
{
text: "Contrato",
dataIndex: 'contrato',
width: 70,
editor: {
xtype: 'textfield'
}
},
{
text: "Software",
dataIndex: 'valor_software',
renderer: 'usMoney',
width: 70,
editor: {
xtype: 'numberfield',
minValue: 0,
maxValue: 1000,
allowDecimals : true
}
},
{
text: "Comunicação",
dataIndex: 'valor_comunicacao',
renderer: 'usMoney',
width: 70,
editor: {
xtype: 'numberfield',
minValue: 0,
maxValue: 1000,
allowDecimals : true
}
},
{
text: "Comodato",
dataIndex: 'valor_comodato',
renderer: 'usMoney',
width: 70,
editor: {
xtype: 'numberfield',
minValue: 0,
maxValue: 1000,
allowDecimals : true
}
},
{
text: 'Empresa para faturar',
dataIndex: 'fatura',
width: 200,
editor:
{
xtype: 'combobox',
displayField: 'descricao',
valueField: 'descricao',
store: 'ComboFaturas',
name: 'software',
queryMode: 'local'
}
}
],
initComponent: function() {
this.callParent(arguments)
}
});
请注意,我从代码中删除了所有“layout:'fit'”(主视图除外,它对其他视图有影响),因为它无论如何都不起作用…:)
如果我需要提供任何额外的信息,请告诉我。我试着让下面的图片更容易理解
谢谢你们 它的工作原理如下:
autoScroll
config选项fit
布局只能有一个项目-如果是网格,则其高度(和宽度)由父容器的大小控制autoScroll
config选项fit
布局只能有一个项目-如果是网格,则其高度(和宽度)由父容器的大小控制autoScroll
config选项fit
布局只能有一个项目-如果是网格,则其高度(和宽度)由父容器的大小控制autoScroll
config选项fit
布局只能有一个项目-如果是网格,则其高度(和宽度)由父容器的大小控制总而言之:如果你想要一个网格滚动,它必须有一个高度。请发布你的代码,并指定你正在使用的ExtJs版本,这样会更容易帮助你。你是对的,我以前没有发布代码,因为我觉得太多了。。。我用代码编辑了这篇文章。。。我使用的是ExtJS4。谢谢!:)请发布您的代码,并指定您正在使用的ExtJs版本,这样会更容易帮助您。您是对的,我以前没有发布代码,因为我认为这太多了。。。我用代码编辑了这篇文章。。。我使用的是ExtJS4。谢谢!:)请发布您的代码,并指定您正在使用的ExtJs版本,这样会更容易帮助您。您是对的,我以前没有发布代码,因为我认为这太多了。。。我用代码编辑了这篇文章。。。我使用的是ExtJS4。谢谢!:)请发布您的代码,并指定您正在使用的ExtJs版本,这样会更容易帮助您。您是对的,我以前没有发布代码,因为我认为这太多了。。。我用代码编辑了这篇文章。。。我使用的是ExtJS4。谢谢!:)嗨,Saki!谢谢你的回复。。。我想根据它的父容器来控制网格的大小,所以我需要将它的父容器布局定义为“适合”,对吗?但是,如果这个父容器已经有了一个具有“适合”布局的“父容器”,它会工作吗?是的,您可以将容器嵌套在容器中,但不要不必要地这样做。另外,注意每一层嵌套都配置了一些
布局!谢谢你的回复。。。我想根据它的父容器来控制网格的大小,所以我需要将它的父容器布局定义为“适合”,对吗?但是,如果这个父容器已经有了一个具有“适合”布局的“父容器”,它会工作吗?是的,您可以将容器嵌套在容器中,但不要不必要地这样做。另外,注意每一层嵌套都配置了一些布局!谢谢你的回复。。。我想根据网格的父级控制网格的大小