Eayui datagrid imitates the browser CTRL + F to search and locate eayuidatagrid

Source: Internet
Author: User

Eayui datagrid imitates the browser CTRL + F to search and locate eayuidatagrid


Stores the number of records that match successfully. You can click the query button to skip these rows.

Var tempIndex = [];

Query Functions

Function searchText (dg, t) {// parameter: $ ("# datagrid"), $ ("# text")

Dg. datagrid ("unselectAll ");
Var rows = dg. datagrid ("getData"). rows;
Var columns = dg. datagrid ('getcolumnfields ');
Var searchVal = t. val ();
For (var I = 0; I <rows. length; I ++ ){
For (var j = 1; j <columns. length; j ++ ){
If (rows [I] [columns [j]. indexOf (searchVal)> = 0 ){
If (! TempIndex. contains (I )){
Dg. datagrid ("selectRow", I );
TempIndex. push (I );
Return;
}
}
}
If (I = (rows. length-1 )){
TempIndex = [];
}
}

}

Datagrid settings

$ ("# CargoAgentTable"). datagrid ({
Url: "../webresources/login/SQL/getCargoAgentCod ",
Method: 'get ',
Fit: false,
Pagination: false,
Width: 486,
Height: 448,
SingleSelect: false,
CheckOnSelect: false,
OnClickRow: function (index, row ){
$ (This). datagrid ("unselectAll ");
$ (This). datagrid ("selectRow", index );
},
OnCheck: function (index, row ){
$ (This). datagrid ("unselectAll ");
$ (This). datagrid ("selectRow", index );
},
Columns :[[{
Field: "ck ",
Checkbox: true
},{
Field: 'client _ COD ',
Title: 'forwarder encoding ',
Sortable: true,
Width: 80
},{
Field: 'user _ Code ',
Title: 'code ',
Sortable: true,
Width: 60
},{
Field: 'client _ NAM ',
Title: 'forwarder name ',
Sortable: true,
Width: 180
},{
Field: 'shot _ NAM ',
Title: 'abbreviation ',
Sortable: true,
Width: 80
}
]
});

Dialog Box

$ ("# BusinessCargoKindNam_SCFQ"). on ("dblclick", function (){
TempIndex = [];
$ ("# BusinessCargoKindTable"). datagrid ("uncheckAll ");
$ ("# BusinessCargoKindDialog" ).css ('display', 'block'). dialog ({
Title: "Goods List ",
Closed: false,
Width: 300,
Toolbar: "# businessCargoKindDialogToolbar ",
Height: 450,
Resizable: true,
Cache: false,
Modal: true,
Buttons :[{
Text: 'save ',
IconCls: 'icon-save ',
Handler: function (){
Var nam = "";
Var cod = "";
Var rows = $ ("# businessCargoKindTable"). datagrid ("getChecked ");
$. Each (rows, function (I, v ){
Nam + = v. SYS_NAM + ",";
Cod + = v. SYS_COD + ",";
});
If (nam ){
Nam = nam. substr (0, nam. length-1 );
}
If (cod ){
Cod = cod. substr (0, cod. length-1 );
}
$ ("# BusinessCargoKindNam_SCFQ"). val (nam );
$ ("# BusinessCargoKind_SCFQ"). val (cod );
$ ("# BusinessCargoKindDialog"). dialog ('close ');
}
},{
Text: 'cancel ',
IconCls: 'icon-cancel ',
Handler: function (){
$ ("# BusinessCargoKindDialog"). dialog ('close ');
}
}]
});
});

I wrote about it and used it after saving it.

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.