【发布时间】:2016-07-25 04:01:36
【问题描述】:
我有一个带有以下代码的剑道网格:
var data = <?php echo $model->over_view; ?>;
var grid = $("#grid").kendoGrid({
dataSource: {
data: data,
pageSize: 10,
sort: { field: "metric", dir: "asc" }
},
dataBound: function () {
$('td').each(function () {
if($(this).text() == 0){
$(this).text('.');
}
if ($(this).text() == 'Bad') {
$(this).addClass('critical')
} else if ($(this).text() == 'Good') {
$(this).addClass('ok')
} else if ($(this).text() == 'Suspect') {
$(this).addClass('warning')
} else if ($(this).text() == 'Idle') {
$(this).addClass('idle')
}
})
},
//rowTemplate: '<tr class="#: classification ==\"Good\" ? "discontinued" : "" #" data-uid="#: uid #"><td>#: classification #</td><td>#: MAC #</td> <td>#: f_Auth #</td><td>#: f_Assoc #</td><td>#: f_EAP #</td><td>#: f_EAPOL #</td><td>#: f_Data #</td><td>#: f_DHCP #</td> <td>#: f_Unk #</td><td>#: metric #</td></tr>',
sortable: true,
resizable : true,
pageable: true,
toolbar: kendo.template($("#filterDeviceType").html()),
columns: [
{ field: "classification", title: "Device Health",headerAttributes:{ style:"text-align:center"}},
{ field: "display_mac", title: "Devices", width: 150,headerAttributes:{ style:"text-align:center "}, template:"<a target=\"_blank\" href='"+$("#visualize-url").val()+ "?trace_id=" + $("#trace-id").val()+"&mac="+"${MAC}&perspective=${type}'>${display_mac}</a>" },
{ field: "f_Auth", title: "Authentication Failure",headerAttributes:{ style:"text-align:center"} },
{ field: "f_Assoc", title: "Association Failure",headerAttributes:{ style:"text-align:center"}},
{ field: "f_ReAssoc", title: "Re-Association Failure",headerAttributes:{ style:"text-align:center"}},
{ field: "f_EAP", title: "EAP Failure" ,headerAttributes:{ style:"text-align:center"}},
{ field: "f_EAPOL", title: "EAPOL Failure",headerAttributes:{ style:"text-align:center"}},
{ field: "f_Data", title: "Data Failure",headerAttributes:{ style:"text-align:center"}},
{ field: "f_DHCP", title: "DHCP Failure",headerAttributes:{ style:"text-align:center"}},
{ field: "Data", title: "Data Packets",headerAttributes:{ style:"text-align:center"}},
{ field: "Total", title: "Total Packets",headerAttributes:{ style:"text-align:center"}}
]
});
“设备”网格中的第二列是一个超链接,每个行项都指向一个特定的页面。我想添加这个功能,如果用户点击一个行项目,剑道网格会记住点击并相应地更改该行项目的颜色(从蓝色到可能是紫色,就像谷歌在其搜索页面中所做的那样) 我该怎么做?
【问题讨论】:
标签: jquery html css kendo-ui kendo-grid