The DataGrid usage record in jquery Easyui

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.