$("#bizAuthorityDataGrid").dataGrid({
url: '${ctx}/biz/bizProgramDraftBox/listProgramAuthorityData?programId=${bizProgram.id}',
pager: '#bizAuthorityDataGridPage'
, postData: {
pageNo: $('#programAuthorityPageNo').val()
, pageSize: $('#programAuthorityPageSize').val()
}
, inputPageNo: $('#programAuthorityPageNo')
, inputPageSize: $('#programAuthorityPageSize'),
sortableColumn: false,
shrinkToFit: true,
autoGridWidth: function(){return $(window).width()*0.96},//自动宽度
autoGridHeight: function(){return $(window).height()*0.45}, // 设置自动高度
searchForm: $("#searchForm"),
// 设置数据表格列
columnModel: [
{header:'${text("ID")}', name:'id', index:'id', width:200, align:"center", frozen:true, hidden:true}
,{header:'${text("作品名称")}', name:'gcName', index:'gcName', width:200, align:"center", frozen:true,
formatter: function(val, obj, row, act){
return (val !=null && val !='')?(val||row.id): row.copyright
}},
{header:'${text("版权属性")}', name:'copyrightAttribute', width:150, editable:true, edittype:'text', editoptions:{'maxlength':'100', 'class':'form-control'}},
{header:'${text("许可使用渠道")}', name:'licenseUseChannel', index:'licenseUseChannel', width:150, align:"center", formatter: function(val, obj, row, act){
return js.getDictLabel(${@DictUtils.getDictListJson('license_use_channel')}, val, '${text("未知")}', true);
}},
{header:'${text("许可使用地域")}', name:'licenseUseArea', index:'licenseUseArea', width:150, align:"center", formatter: function(val, obj, row, act){
return js.getDictLabel(${@DictUtils.getDictListJson('license_use_area')}, val, '${text("未知")}', true);
}},
{header:'授权描述', name:'detailDesc', width:300,edittype:'textarea', editoptions:{'maxlength':'500', 'class':'form-control', 'rows':'1'}},
],
// 加载成功后执行事件
ajaxSuccess: function(data){
// 为每个单元格添加.text-ellipsis-3类
$("#bizAuthorityDataGrid").find('td').addClass('text-ellipsis-3');
}
});
CSS:.text-ellipsis-3 {
display: -webkit-box;
-webkit-line-clamp: 3;
-webkit-box-orient: vertical;
overflow: hidden;
word-break: break-all;
line-height: 1.4;
max-height: 4.2em;
}
以上代码加了$("#bizAuthorityDataGrid").find('td').addClass('text-ellipsis-3');后,原本列变成了行,每行宽度为整张表。但是去掉display: -webkit-box;列不会变成行。如何修改以上代码,生成预览。
最新发布