我正在尝试查找ag-grid中存在的行数。 表结构;看起来像这样:
<div class="ag-body-container" role="presentation" style="height: 500px; top: 0px; width: 1091px;">
<div role="row" row-index="0" row-id="0" comp-id="134" class="ag-row ag-row-no-focus ag-row-even ag-row-no-animation ag-row-level-0" style="height: 50px; top: 0px; ">
<div role="row" row-index="1" row-id="1" comp-id="140" class="ag-row ag-row-no-focus ag-row-odd ag-row-no-animation ag-row-level-0" style="height: 50px; top: 50px; ">
<div role="row" row-index="2" row-id="2" comp-id="146" class="ag-row ag-row-no-focus ag-row-even ag-row-no-animation ag-row-level-0" style="height: 50px; top: 100px; ">
<div role="row" row-index="3" row-id="3" comp-id="152" class="ag-row ag-row-no-focus ag-row-odd ag-row-no-animation ag-row-level-0" style="height: 50px; top: 150px; ">
<div role="row" row-index="4" row-id="4" comp-id="158" class="ag-row ag-row-no-focus ag-row-even ag-row-no-animation ag-row-level-0" style="height: 50px; top: 200px; ">
在其他div下,还有更多行与class="ag-row ag-row-no-focus ag-row-odd ag-row-no-animation ag-row-level-0"
相同。所以我不能直接用这个类来搜索行。
欣赏任何形式的帮助。
答案 0 :(得分:1)
尝试使用此css选择器div.ag-body-container > [role="row"]
,它只计算当前视口中的行数。我注意到ag-Grid上的演示,当您向下滚动网格时,将显示另一批行。因此,如果您的网格也类似于此,则上面的css选择器无法获取在视口中不可见的所有数据行。