Suppose i have a column that contains many values eg Say we have a table in which the teacher's name and amp; Department (different from comma) in which a teacher can be related to many departments
I want to search for those lines that contain the starting section of the search field.
I am currently using BW filter which works for the first entry only, a comma separated list (as it takes the entire list as a string)
jqGrid does not offer you any possibility of custom operation such as "starting with" substrings separated by commas. So someone has to use standard operation. On the other hand, during the filtering, subdivisions of the $ .jgrid.from
objects used by jqGrid I have already posted some other answers that reflect the technique. It's still not so easy, so I made that indicating that starts
method $. Like Jgrid.from
, it works specially as if you need it, but only in special columns (continuously view "department"
in the code below)
var oldFrom = $ .jgrid.from; $ .jgrid.from = function (source, initalQuery) {var results = old frame (source, initalQuery), old_startswith = result.startsWith; Results: stars = function (F, V) {if (f! == "department") {return old_startsWith.call (results, f, v); } Var Self = result, val = (v === empty)? F: v, length = val.toString (). Length; Self._append ('jQuery.map (' + self._getStr ('jQuery.jgrid.getAccessor (this, \' + + F + '' '') + '.split (","), function (item) {If (item.substr (0, '+ length +') === '+ self._getStr (' '' + self. Store (v) + '"') +") {return item;}}). Length = 1); Self._setCommand (with self, star); self._resetNegate (); self return;}; return result;};
If a string is " D2 ", then the following results will be seen
Comments
Post a Comment