Is it possible to have something like Complex Search from jqgrid?

Is it possible to have something like Complex Search from jqgrid?

ttbackttback Posts: 19Questions: 0Answers: 0
edited July 2012 in Feature requests
I saw some complex search demo on jqgrid today: http://www.trirand.com/blog/jqgrid/jqgrid.html#Complex%20search
If you go to Searching > Complex Search, you will see a demo that you can do Complex Search on the jqgrid.

I know Datatables supports column filtering and am already using the plugins for filtering with range check etc. I'm using the plugin from here:
http://jquery-datatables-column-filter.googlecode.com/svn/trunk/index.html and it covers the basic use cases.

But the demo of Complex Search impressed one of our clients enough that now I have to make a demo for jqgrid's capabilities. It does look very close to how they usually work in Excel. Now I obviously would love to keep Datatables so I wonder if there is something we can do to reuse the jqgrid's complex search module to process data and render the results in Datatables?

I tried to trace the code behind the module myself but It is very difficult, hard to pinpoint which is which. I wonder if anyone here had similar ideas or had been in a similar situation and I would be thankful for any tips.

Replies

  • allanallan Posts: 61,686Questions: 1Answers: 10,100 Site admin
    It is absolutely possible since it is just calls to the fnFilter function that you would ultimately need to make (and define a few custom filters for ranges etc), however there isn't a pre-build 'widget' that provides this functionality for DataTables. It certainly wouldn't be added to the core since it would add significant code size, but it would sound like an idea option for an 'extra'.

    There are already a few filtering extras for DataTables:

    https://github.com/cyberhobo/ColumnFilterWidgets
    http://jquery-datatables-column-filter.googlecode.com/svn/trunk/index.html

    but there isn't an open source filtering UI that is that comprehensive yet.

    Allan
  • ttbackttback Posts: 19Questions: 0Answers: 0
    Yea, I think the UI piece is okay, I can probably build it quickly, except for the subtree piece.
    I think I can utilize the regex filtering that comes with datatables to do some basic filtering and I'm not too concerned with building that widget's UI myself. But I think it can get tricky if user wants multiple conditions for one column. Is there any way I can run fnfilter repeatedly and get a hold of its result dataset? (I might need to run it recursively: pass regex1, get result1, pass regex2 against result1, get result2, etc)
  • allanallan Posts: 61,686Questions: 1Answers: 10,100 Site admin
    You would either need to use regex to do combination filtering, or use a custom filter: http://datatables.net/development/filtering . The custom filters could be made really complex - I've seen one in the past that does fuzzy matching for example (takes the word your search for and will find similar words as well).

    In theory you could make your filtering entirely based on a single custom filter which is configured the way you need :-)

    Allan
This discussion has been closed.