To store the number of record rows successfully matched, click the query button continuously to skip these rows
var tempindex=[];
Query function
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: ' Cargo Agent Code ',
Sortable:true,
Width:80
}, {
Field: ' User_code ',
Title: ' Code ',
Sortable:true,
Width:60
}, {
Field: ' Client_nam ',
Title: ' Freight forwarder name ',
Sortable:true,
width:180
}, {
Field: ' Shot_nam ',
Title: ' Abbreviation ',
Sortable:true,
Width:80
}
]]
});
Pop-up box settings
$ ("#businessCargoKindNam_SCFQ"). On ("DblClick", function () {
tempindex=[];
$ ("#businessCargoKindTable"). DataGrid ("Uncheckall");
$ ("#businessCargoKindDialog"). CSS (' Display ', ' Block '). Dialog ({
Title: "List of goods",
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 ');
}
}]
});
});
Probably wrote it and used it after the draft.
Eayui DataGrid mimics browser Ctrl+f search targeting