[1.10] How do I search a column with regular expression? - column().search() with Regular Expression

[1.10] How do I search a column with regular expression? - column().search() with Regular Expression

blueeinsteinblueeinstein Posts: 2Questions: 0Answers: 0
edited March 2014 in DataTables 1.10
Been staring at this for a while, and couldn't figure this out. Looking at, http://next.datatables.net/reference/api/column().search()

API: column().search( input [, regex[ , smart[ , caseInsen ]]]

Trying to filter a column with a 'startsWith' letter "K" function, I tried below but didn't work:
oTable.columns(2).search("K*", true, false, true).draw(); // regex=true, smart=false, case=true

I saw on the forums to add "\b" (to notate startsWith), doesn't work either:
oTable.columns(2).search("\bK*", true, false, true).draw(); // regex=true, smart=false, case=true

Naturally, I tried the common regular expression "^", doesn't work either:
oTable.columns(2).search("^K*", true, false, true).draw(); // regex=true, smart=false, case=true

Help please?

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    I think you want just `^K`:
    http://live.datatables.net/mobedan/1/edit

    Allan
  • blueeinsteinblueeinstein Posts: 2Questions: 0Answers: 0
    Perfect, that worked. Question, are the fnGetData and all the fnFunction going to be available in 1.10? I have to compliment you guys on this library, really great. The only hard part is (as with any software evolution), is finding out what works between various versions.
  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Thanks very much. Its takes a while, but I get there :-)

    Yes, fnGetData and friends will work in 1.10. The 'New API' section of the upgrade notes mentions this:
    http://next.datatables.net/new/1.10

    Allan
This discussion has been closed.