JQGrid-如何将HTML插入网格页脚



我目前正在使用免费的jqGrid(版本3.4.1.(,我已经构建了一个带有页脚的网格。这个网格有点特殊,因为列的数量是动态定义的(列的数量取决于我的数据库中某些数据的数量(。

因此,我尝试将图标(使用HTLM代码(插入到生成的每个动态列中。

我已经编写了在每列上循环的代码部分,我可以插入纯文本,正如您在屏幕截图中看到的那样。屏幕截图我不想用图标(字体很棒或简单的引导符号图标(代替这个纯文本。

这是我目前拥有的代码(只有网格的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);
}

两个选项(取决于您(-

  1. 在jqgrid中呈现从服务器获取的纯文本html行
Use/Set colmodel datatype = 'html'
  1. 如果你只想设置字体很棒的图标或引导程序图标,(示例-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.

最新更新