直接写代码,应该有更好的方法。
构造参数的js文件:
var option = {//构造FlexiGrid
url: "../../Manage/ManagerView/Ashx/srxfhz.ashx",
KeyboardSelect: true, //允许键盘上下进行选择当前行
resizable: true, //允许改变表格大小
dataType: 'json',
colModel: [
{ display: '消费日期', name: 'bill_comedate', width: 200, sortable: false, align: 'center' },
{ display: '消费金额', name: 'bill_zhje', width: 180, sortable: true, align: 'center' },
{ display: '开台数量', name: '消费桌数', width: 180, sortable: true, align: 'center' },
{ display: '消费单数', name: '消费桌数', width: 180, sortable: true, align: 'center' },
{ display: '消费人次', name: '消费人次', width: 180, sortable: true, align: 'center' }
striped: true,
usepager: true,
title: '折后应收汇总',
useRp: true,
rp: 40,
showTableToggleBtn: false,
width: 'auto',
height: 600,
rpOptions: [10, 15, 20, 25, 40, 50], //可选择设定的每页结果数
procmsg: '请等待数据正在加载中 …',
pagestat: '显示从{from}到{to}条数据,共有{total}条数据',
resizable: false,
sortname: "bill_comedate",
sortorder: 'DESC',
onSubmit: function() {//获取数据时执行
AjaxMessageSwitch(true);
return true;
},
onEnd: function() {//获取数据结束时执行
AjaxMessageSwitch(false);
var tr = $("#customers").find("tr");
$(tr).each(function() {
//找到含有总计的那一行添加样式
if ($(this).find('td').find('div').text().indexOf('总计') >= 0) {
$(this).find('td').find('div').css("color", "red").css("font-weight", "bold");
return false;
}
});
},
InputDataJson: function() {
return { TextKey: $("#Key").val() };
},
onAllowKeyboardSelect: function() {
if (document.activeElement.id == "Key") {
return false;
}
return true;
}
};
前台ASPX页面
<script type="text/javascript">
$(document).ready(function(e) {
$("#customers").flexigrid(option);
});
</script>
主要就是在onEnd:里面循环比较,找到符合条件的数据,然后添加样式。
各位有更省事的方法,还忘告知。