1. Delete Row method (deleterow)
$ ('#ruleManagementTable'). DataGrid ('deleterow'1 //1 represents the selected row index
2. Delete multiple rows of data
varrows = $ ('#ruleManagementTable'). DataGrid ("getselections");//get all the rows you select//loops the selected row for(vari =0, l=rows.length;i<l;i++){ varIndex = $ ('#ruleManagementTable'). DataGrid ('Getrowindex', Rows[i]);//gets the line number of a row$('#ruleManagementTable'). DataGrid ('DeleteRow', index);//remove the row by line number
}
Note: (1)var rows = $ ('#ruleManagementTable'). DataGrid ("getselections"); // Get all the rows you have selected , and return an array with the rows of objects
(2)var index = $ ('#ruleManagementTable'). DataGrid ('getrowindex', rows[i]); gets the line number of a row , because rows is an array, you mustRows[i]The form, otherwise it is not get the line number, get not to be-1; if row has filtered only one, then writeRows[0].
3 . Insert Row InsertRow
//Insert a new row at the position of the second row//Index : The row index to insert, and if the index value is undefined, a new row is appended. //Row : line data. $('#dg'). DataGrid ('InsertRow', {index:1,//Index starting from 0row: {name:'New name', Age: -, note:'New News' }});
// New Rule Library table Getdesktopobj (). $ ('#ruleManagementTable'). DataGrid (' InsertRow', { index:0, row: { softId:jsondata.softId, SoftName:jsondata.softName, genRightRule:jsondata.genRightRule, ungenrightrule: Jsondata.ungenrightrule }});
4. Reload, and remotely pass in parameters
$ ("#inside_tableElement"). DataGrid ("load", { "genuineserialnumbermanagement.type": Type, " Genuineserialnumbermanagement.softdisplayname " : Softdisplayname});
5, when the initialization of the remote input parameters Queryparams
//Genuine Serial Number Library listvarType = $ ("input[name= ' serialnumber ']:checked"). Val (); $ ("#inside_tableElement"). DataGrid ({striped:true, Collapsible:true, Height: -, URL:"${basepath}/genuineserialnumbermanagementaction_list.do", queryparams:{ "Genuineserialnumbermanagement.type" : Type}, columns: [[{field:'Softdisplayname', Title:'Software name', align:'Center', Width: (datag_width *0.44)}, {field:'version', Title:'Version number', align:'Center', Width: (datag_width *0.44)}, {field:'serialnumber', Title:'Serial Number', align:'Center', Width: (datag_width *0.44)}]], Fitcolumns:true, Rownumbers:true, pagination:true, PageSize: -, pagelist: [ -, -, -], onselectall:function () {}, Onunselectall:function () {}, Onselect:function () {}, Onuns Elect:function (RowIndex, RowData) {}});
6.
The DataGrid usage record in jquery Easyui