本文共 1188 字,大约阅读时间需要 3 分钟。
改写ui-grid headerCellTemplate myHeaderCellTemplate 中为uigrid表头模板,此处copy过来,改写 /**改写ui-grid myHeaderCellTemplate,注意必须增加 trustHtml过滤器(在模块中增加)* 取代原有的 CUSTOM_FILTERS *** * myApp.filter('trustHtml', function ($sce) { * return function (input) { * return $sce.trustAsHtml(input); * } * }); * **/ //原: { { col.displayName CUSTOM_FILTERS }} //现: var myHeaderCellTemplate =``; function rebuildColumnDefs(data){ var columnDefs = []; if(data && data.length){ data.forEach(function(val,idx){ columnDefs.push({ name: val.data, displayName: val.title, minWidth: 150, //headerCellTemplate: '{ {col.sort.priority + 1}}Name \n (editable)'//这种方式会改变表头样式和相关功能,只能在极其简单情况下使用 //headerCellTemplate: ''+val.title+'' headerCellTemplate:myHeaderCellTemplate }); }); } return columnDefs; }
转载地址:http://ukkxi.baihongyu.com/