我目前正在使用免费的jqGrid(版本3.4.1),并且已经建立了带有页脚的网格。该网格有点特殊,因为列数是动态定义的(列数取决于数据库中某些数据的数量)。
因此,我试图将图标(带有HTLM代码)插入到所生成的每个动态列中。
我已经写了代码部分在每列上循环,并且可以插入纯文本,如您在此屏幕截图中所见。屏幕快照我不希望用一个图标(真棒字体或简单的bootstrap glyphicon)替换该纯文本。
这是我当前拥有的代码(仅网格的gridComplete函数,请告诉我:
gridComplete: function() {
var tabData = grid.jqGrid('getRowData')
var footerCells = {"DONATEUR":"ACTION GLOBALES"};
var footerCells2 = {}
for (var i = 0; i < colModel.length-3; i++) {
var indexCol = colModel[i+3].name
footerCells[indexCol] = "test" // content of the cell here
}
grid.jqGrid(
"footerData",
"set",
footerCells,
false
)
var $footerRow = grid.closest(".ui-jqgrid-bdiv").next(".ui-jqgrid-sdiv").find(".footrow");
var $donateur = $footerRow.find('>td[aria-describedby="jqGrid-table-suivictrp_DONATEUR"]'),
$montantDon = $footerRow.find('>td[aria-describedby="jqGrid-table-suivictrp_MT_DON"]'),
width2 = $donateur.width() + $montantDon.outerWidth();
$montantDon.css("display", "none");
$donateur.attr("colspan", "2").width(width2);
}
两种选择(取决于您)-
- 在jqgrid行中呈现从服务器获取的纯文本html
Use/Set colmodel datatype = 'html'
- 如果您只想设置字体超赞的图标或引导程序图标,(示例-https://free-jqgrid.github.io/getting-started/index.html#type_of_data_code)
You need to set the `iconSet` property in jqGrid options and `template` property in colmodel to use it.
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句