mini-datagrid 鼠標移到單元格顯示

單元格內容超過了現有的寬度,所以需要鼠標移上去顯示單元格全部內容,類似標籤屬性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>

 

完美解決問題

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章