function initTable (State, theGroup) { $ ( '#dataTable' ) .datagrid ({ URL: The rootUrl + 'Device / DEVICE_INFO / GetDataList' , Method: 'the POST' , queryParams: { 'State': State, 'the GroupName' : theGroup}, // ------- submit parameters idField: 'Id' , Fit: to true , fitColumns: to true , scrollbarSize: 0 , no more data content when ------ // remove excess integration blank singleSelect : false , selectOnCheck: false// ------ select the check box selected row, ugly style does not look good, you need a custom style checkOnSelect: to true , // ----- click on the row select the check box effect, if there is no conflict js references click OK to write the desired effect event (onClickRow ()) // sortName: 'Id', // sortOrder: 'asc', // rownumbers: to true, pagination: to true , pageSize: 10 , // nowrap: false, pageList: [10, 20, 30, 50, 100, 150, 200 ], // ------ paging parameters page shows how many parameters must be set to write custom objects js @ ShowFooter: to true, Columns: [ [ {title: 'CK', Field: 'CK', CheckBox: to true }, {title:'xxxx', field: 'Id', width: 200,hidden:'true'}, { title: 'xxxx', field: 'Device_Name', width: 200 }, { title: 'xxxx', field: 'Device_Ordernum', width: 200 }, { title: 'xxxx', field: '__', width: 60, fixed: true,align:'center',formatter: function (value, row) { var html = ''; ....return html; } } ]], onBeforeLoad: function $ (ed.target) .combobox ({ (param) { }
// ------- key operation (an open editable state) -------- // onDblClickCell: function (index, Field) { IF (! = EditIndex index) { IF ( endEditing ()) { $ ( '#dataTable') DataGrid ( 'SelectRow', index) .datagrid ( 'also beginEdit'. , index); EditIndex = index; var ED = $ ( '# the dataTable') DataGrid ( 'getEditor. ' , {index: index, Field: Field}); IF (ED) { onLoadSuccess: function () { var theId = $(ed.target).combobox('getData').find(function (item) { if (item.G_State == "是") return item }); $(ed.target).combobox('select', theId.Id); }, onChange: function () { }, }) } } else { setTimeout(function () { $( . '#dataTable') DataGrid ( 'SelectRow' , EditIndex); }, 0 ); } } },
// ------ key operation (two, return values at the end of the preparation) - // --- onEndEdit: function (index, Row) { var ED = $ ( '# the dataTable') DataGrid ( 'getEditor'. , { index: index, Field: 'the GroupName' , }); row.GroupId = $ (ed.target) .combobox ( 'the getValue' ); row.GroupName = $ (ed.target) .combobox ( 'getText'); } }); }
//------需要引用的参数------//
var editIndex = undefined; function endEditing() { if (editIndex == undefined) { return true } f ($('#dataTable').datagrid('validateRow', editIndex)) { $('#dataTable').datagrid('endEdit', editIndex); editIndex = undefined; return true; } else { return false; } }