美文网首页
列表字段超出省略显示

列表字段超出省略显示

作者: 可乐_加冰_ | 来源:发表于2023-01-11 01:16 被阅读0次
  • 方法一

 {field: 'content', title:'内容', operate: false,
                            formatter : function(value, row, index, field){
                                return "<span style='display: block;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;' title='" + row.content + "'>" + value + "</span>";
                            },
                            cellStyle : function(value, row, index, field){
                                return {
                                    css: {
                                        "white-space": "nowrap",
                                        "text-overflow": "ellipsis",
                                        "overflow": "hidden",
                                        "max-width":"150px"
                                    }
                                };
                            }

                        },
  • 方法2

{field: 'content', title: __('Content'), operate: 'LIKE', 
    // 加入代码
    formatter: function(value){return value.toString().substr(0, 20)}
    // 加入代码--end
}

相关文章

网友评论

      本文标题:列表字段超出省略显示

      本文链接:https://www.haomeiwen.com/subject/tdnmcdtx.html