0

我正在尝试使列表中列表项的最小高度等于 100 px,以便为 2 行留出更多空间

.x-list .x-list-item 
{
    min-height: 500px; /*exaggeration just to see if it works
    background-color: red;
}

背景红色出现了,但是 min-height 不受影响,显然是因为我在 chrome 中检查“检查元素”时某处的 !important css 值

<div class="x-list-item-first x-list-header-wrap x-list-item-last x-list-footer-wrap x-list-item x-stretched x-list-item-tpl x-list-item-relative" id="ext-simplelistitem-1" style="min-height: 42px !important;"><div class="x-unsized x-list-disclosure" id="ext-component-6"></div><div class="x-innerhtml" id="ext-element-81"><div class="list-item-title">Title = Unsaved feed title</div> <div class="list-item-narrative">Unsaved feed narrative</div>  </div></div>

不确定该style="min-height: 42px !important位是如何出现的,因为它不是来自 css 文件 - 彻底检查了文件夹

4

2 回答 2

1

你可以试试这个:

{
                xtype: 'list',
                itemTpl: '{title}',
                itemHeight: 100,
                data: [
                    {title: 'Item 1'},
                    {title: 'This is just a sample piece of code. Try this. It is fitting well.'},
                    {title: 'Item 3'},
                    {title: 'Item 4'}
                ]
}

您只需要设置itemHeight,这允许您设置默认项目高度并用于粗略计算填充列表所需的项目数量。默认情况下,项目的高度约为 50 像素。

默认为: 42 。而已。快乐编码。:)

于 2014-06-05T05:50:43.833 回答
0

设置min-height为 List 模板中的父 div:

itemTpl: new Ext.XTemplate(
        '<div style="min-height:100px;">',
        // ... your elements
        '</div>')
于 2014-06-04T22:11:21.080 回答