UI-grid wrap-text in each cell [closed]

岁酱吖の 提交于 2019-12-13 08:34:58

问题


using angularjs UI-grid,i have increased the rowHeight of the gird. I need to wrap the text in each cell and i need to get rid of the text turnacation.

example http://plnkr.co/edit/9aoV9rkjf9eKpTjcAaC5?p=preview  

word wrap need to be done in name and description column.


回答1:


You need to remove

 -ms-text-overflow: ellipsis;
  -o-text-overflow: ellipsis;
  text-overflow: ellipsis;

from

.ui-grid-cell-contents

and use word-break: break-all;

.ui-grid-cell-contents {
  padding: 5px;
  -moz-box-sizing: border-box;
  -webkit-box-sizing: border-box;
  box-sizing: border-box;

  word-break: break-all;
  overflow: hidden;
  height: 100%;
}

main.css:

.grid {
  width: 100%;
  height: 400px;
}
.ui-grid-cell-contents-break {
   padding: 5px;
  -moz-box-sizing: border-box;
  -webkit-box-sizing: border-box;
  box-sizing: border-box;


  overflow: hidden;
  height: 100%;

  word-break: break-all;
}

app.js:

$scope.gridOptions.columnDefs = [
    { name: 'id' },
    { name: 'name'},
    { name: 'description',cellTemplate:'<div class="ui-grid-cell-contents-break"> This is the test Description</div>'},
    { name: 'age', displayName: 'Age (not focusable)', allowCellFocus : false },
    { name: 'address.city' }
  ];

Plunker: http://plnkr.co/edit/6wDxSAfP8AE6zial4vhw?p=preview



来源:https://stackoverflow.com/questions/53866823/ui-grid-wrap-text-in-each-cell

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!