- function loadMessage() {
- $('#pressure').datagrid({
- height: 500,
- url: '/Home/RealtimeData',
- method: 'POST',
- //queryParams: { 'id': OBJECTID },
- idField: 'ID',
- striped: true,
- fitColumns: true,
- singleSelect: false,
- rownumbers: true,
- pagination: false,
- nowrap: false,
- pageSize: 10,
- pageList: [10, 20, 50, 100, 150, 200],
- showFooter: true,
- columns: [[
- { field: 'ck', checkbox: true },
- { field: 'ElementId', title: 'ElementId', width: 180, align: 'left' },
- { field: 'Label', title: 'Label', width: 180, align: 'left' },
- { field: 'Meter_Name', title: 'Meter_Name', width: 180, align: 'left' },
- { field: 'Station_Un', title: 'Station_Un', width: 180, align: 'left' },
- { field: 'MeasureAre', title: 'MeasureAre', width: 180, align: 'left' },
- { field: 'DistrictAr', title: 'DistrictAr', width: 180, align: 'left' },
- { field: 'Explain', title: 'Explain', width: 180, align: 'left' }
- ]],
- onBeforeLoad: function (param) {
- },
- onLoadSuccess: function (data) {
- if (data) {
- $.each(data.rows, function (index, item) {
- if (item.Display == 1) {
- $('#pressure').datagrid('checkRow', index);
- }
- });
- }
- },
- onLoadError: function () {
- },
- onClickCell: function (rowIndex, field, value) {
- }
- });
- }
在onLoadSuccess 事件中添加循环事件,如果display显示的是一,则将当前那一行设为选中状态。