|
-
Nov 10th, 2012, 12:03 PM
#3
Thread Starter
Hyperactive Member
Re: Searching value containing any string (or part of) in a string array
Ok
I'm not sure if you used jQuery.DataTables before? It have a search function (happening client-side by default) where you can type in parts of the value in one column, part of value of another column, and it will filter down to say where any row have one column where the value CONTAIN this or that. See here for a demo.
I'm using that, but my searching, sorting, etc happen server side. Involved a bit more work.
So to stick to the behaviour of the client side searching, I overridden the tostring method of the objects being listed to be one long string of I want to search on (so for instance, tostring will result in "Jim Chimney VBForums Married Ford Focus Software Developer" for a given row object)
Then when you start typing in the search box I want to break whatever you typed into seperate strings (array) and ask "Give me all rows (object) where any part of the tostring contains any of the items in the array)
So if you type "Jim" or "Jim Ford" or even "Chim Fo Soft", it will return your record an any other record where any part of that record contain any of the given search words.
I'm not sure if that make any sense?
1) Take the search string "Chim Fo Soft" and break into an array : { "Chim", "Fo", "Soft" } - I don't want "Chim " to result in a array with two items though.
2) The match the list of object's tostring values to any of the items in the above. So, so I'm also in there and for instance tostring include "Softtard", my record will also be included (Soft = Softard)
Does that explain it?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|