单元格内容超过了现有的宽度,所以需要鼠标移上去显示单元格全部内容,类似标签属性Title
首先在mini-API中,介绍有mini-datagrid的一个属性是
showCellTip | Boolean | 允许单元格提示框(当宽度变小有省略号时) |
我设置了无效,无语了
后来就换了一个思路,通过drawcell事件重绘单元格
drawcell | { sender: Object, rowIndex: Number, columnIndex: Number, record: Object, column: Object, field: String, value: String, cellHtml: "", rowCls: "", cellCls: "", rowStyle: "", cellStyle: "" } | 绘制单元格时发生 |
function ondrawcell(e) {
var row = e.row,
column = e.column,
field = e.field,
value = e.value;
if (field == "Title") {
e.cellHtml = '<span title="' + row.Title+'">' + row.Title + '</span>';
}
}
<div id="treegrid1" class="mini-treegrid" style="width:100%;"
showTreeIcon="true" treeColumn="taskname" idField="Id" parentField="ParentsId"
resultAsTree="false"
allowResize="true"
expandOnLoad="true"
allowCellEdit="true"
allowCellSelect="true"
showCellTip="true"
ondrawcell="ondrawcell"
>
<div property="columns">
<div name="taskname" field="Title" width="200">
目标任务
<input property="editor" class="mini-textbox" style="width:100%;" />
</div>
<div field="ResponsibilityUnit" width="100">
责任单位
<!--<input property="editor" class="mini-textbox" style="width:100%;" />-->
<div property="editor" class="mini-combobox" style="width:100%;" valueField="id" textField="name" autoShowPopup="true" id="combo1"
showNullItem="true" allowInput="true"
onvalidation="onComboValidation" emptyText="请选择..." nullItemText="请选择..." name="ResponsibilityUnit"
data="json">
</div>
</div>
</div>
</div>
完美解决问题