Filtering using StartsWith not Contains

Filtering using StartsWith not Contains

deva2012deva2012 Posts: 2Questions: 0Answers: 0
edited January 2013 in DataTables 1.8
Hi,

I was using Jquery DataTable grid. I need to make the grid to search the input based on StartsWith in a word of a string. Consider the example,

Records in my DB.

1. Financial services industry

2. European Union countries

3. Economic integration


If I Input the character 'c' against those 3 records, the result should come with only 2nd record matching the 3rd words 1st character of a string ('c'ountries).

If I input 'i' , only the 3rd record should come by matching ('i'ntegration). I didn't find anything based on my requirement. Also I have no idea what functionality should i use. Please suggest me what will be the best suite for my requirement.



Thanks

Replies

  • allanallan Posts: 61,697Questions: 1Answers: 10,102 Site admin
    You want to use regular expression filtering, rather than the built in 'smart filtering'. For that you need to use fnFilter and then search on something like `'\b'+myInput` with smart filtering disabled.

    Allan
This discussion has been closed.