sap.ui.table.Table:滚动无法查看所有数据

时间:2018-03-05 21:22:48

标签: sapui5

sap.ui.Table问题:滚动时,我无法直到最后。我很想使用downpress键直到最后。这不是预期的 高度是每行的变量。每行最多可显示3行文字

  

    <t:Table id="phraseTable" class="phraseTable"  enableBusyIndicator="true"  columnHeaderHeight="21" enableColumnReordering="false"
   selectionMode="Single" cellClick="onCellClick"  visibleRowCountMode="Auto"  selectionBehavior="RowOnly" rows="{dataModel>/phraseTable}">

<t:columns>
 <t:Column hAlign="Center" resizable="true">
    <Label text="No." wrapping="true"/>
    <t:template>
    <Text text="{dataModel>Phrase_id}" tooltip="{dataModel>Phrase_id}" class="PhrasesText" wrapping="true" textAlign="End"/>
    </t:template>
 </t:Column>
 <t:Column  hAlign="Center" resizable="true">
   <Label text="Phrases"  />
   <t:template>
    <FormattedText id="test"  htmlText="{dataModel>Phrase_desc}" class="maxlines PhrasesText" tooltip="{
        path: 'dataModel>No_tags'
    }">
   </FormattedText>
  </t:template>
 </t:Column>
 <t:Column hAlign="Center" resizable="true">                 
  <Label class="headerClass commonSorting" text="Status"/>
   <t:template>
   <Text class="PhrasesText" text="{dataModel>Status_desc}" tooltip="{dataModel>Status_desc}" wrapping="true"/>
  </t:template>
 </t:Column>
 <t:Column hAlign="Center" resizable="false">  
  <Label class="headerClass commonSorting" text="Geography" />  
  <t:template>
   <Text class="Phrases" text="{dataModel>Geography_desc}" tooltip="{dataModel>Geography_desc}" wrapping="false"/>
  </t:template>
 </t:Column>
 <t:Column hAlign="Center"
  resizable="false">
  <Label class="headerClass commonSorting" text="Regulatory class" />
  <t:template>
   <Text class="Phrases" text="{dataModel>Regulatory_desc}" tooltip="{dataModel>Regulatory_desc}" wrapping="false"/>
  </t:template>
 </t:Column>
 <t:Column hAlign="Center" resizable="false">
  <Label class="headerClass commonSorting" text="Author"/>
  <t:template>
   <Text   class="PhrasesText" text="{dataModel>Author_desc}" tooltip="{dataModel>Author_desc}" wrapping="false"/>
  </t:template>
 </t:Column>
</t:columns>

CSS已使用

  

.maxlines {
  display: inline-block; /* or inline-block */
  text-overflow: ellipsis;
  word-wrap: break-word !important;
  overflow: hidden !important;
  max-height: 62.5px !important;
  line-height: 16px !important;
  text-align: left !important;
} 

任何领导或帮助将不胜感激。感谢

2 个答案:

答案 0 :(得分:0)

我认为这是一个已知问题,解决方案设置了一个固定的'rowHeight',用于包装行单元格中的内容。这就是因为表首先(使用滚动条)基于它将要采用的项目数(例如,在你的odata中的$ count请求)进行处理,然后将数据提取并与您的单元格控件绑定。如果有大的控件,它们会在滚动条被渲染后扩展单元格高度,因此您无法滚动直到结束。

我的建议是:

  • 选项1。 - 设置一个足够大的rowHeight来包装最大的单元格 内容
  • 选项2。 - 使用不同的工厂功能设置 用于ech行的rowHeight(之前从未尝试过,但它可能有效)
  • 选项3。 - 使用响应表,这对此更好 动态大小调整(sap.m.Table)

答案 1 :(得分:0)

sap.ui.table.*表仅支持在doc以及UX guideline中列出的一组有限控件。此外,文字换行应该被禁用。

  1. 删除可能会操纵像元高度的CSS规则。
  2. 确保仅将受支持的控件用作模板。
  3. 禁用换行:<Text wrapping="false" text="..." />
  

要保持控件高度始终稳定,必须将wrapping控件中的renderWhitespacesap.m.Text属性设置为false { {3}}

使用不受支持的控件或长换行文本通常会导致错误计算垂直滚动高度。尽量避免它们。