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.