Javascript 如何在Jquery网格列中动态启用HTML标记
我需要在Jquery网格列中动态启用HTML标记 我怎样才能做到这一点 我的代码是Javascript 如何在Jquery网格列中动态启用HTML标记,javascript,jquery,jqgrid,struts2-jquery-grid,Javascript,Jquery,Jqgrid,Struts2 Jquery Grid,我需要在Jquery网格列中动态启用HTML标记 我怎样才能做到这一点 我的代码是 jQuery("#jqgrid").jqGrid({ data: $scope.jqgrid_data, datatype: "local", height: 'auto', sortable: false, width: '900', colModel: $scope.ColDefinations,
jQuery("#jqgrid").jqGrid({
data: $scope.jqgrid_data,
datatype: "local",
height: 'auto',
sortable: false,
width: '900',
colModel: $scope.ColDefinations,
viewsortcols: [true, 'vertical', true],
rowNum: $scope.pageSize,
pager: '#pager_jqgrid',
sortname: 'Student Name',
toolbarfilter: true,
viewrecords: true,
sortorder: "asc",
multiselect: false,
autowidth: false,
autoencode: true,
gridview: true,
rownumbers: true,
shrinkToFit: false,
forceFit: true,
loadonce: false,
pgbuttons: false,
});
像这样绑定html
jQuery(".jqg-second-row-header th:eq(" + i + ")").text(titletext[0] + "<span> hai</span>");
jQuery(“.jqg第二行标题th:eq(“+i+”)).text(titletext[0]+“hai”);
谁能帮助我,我错在哪里
提前感谢使用colModel时,您可以使用label选项在列标题中插入任何html标记。如上所述 你可以
...
colModel : [
{ label : "Mynanme <span> hai</span> ", name: "field1",....},
...
],
...
。。。
colModel:[
{标签:“Mynanme hai”,名称:“field1”…},
...
],
...
要动态设置标签,请使用setLabel方法
$(“#jqGrid”).jqGrid(“setLabel”、“field1”、“Myname hai”);
请参见其他参数以更改视觉显示
$("#jqGrid").jqGrid("setLabel", "field1", "Myname <span> hai</span>");