Datatables search without filtering
Datatables search without filtering
I'm hoping this is possible as i'm really starting to like DT.
First some background info.
The Point of Sale that i maintain, currently (and for the last 20yrs) has done searching in a somewhat different way to how webpages typically do it.
Currently in the system, the frontend makes a request for a page of data (lets say a customer list), the backend goes off (we use Progress OpenEdge so the 4GL is awesome at doing this task), finds the first customer based on the query (sorting, filtering, etc...), then once found, gets the next X number of customers to fulfill the page requirement (page size of say 20).
The backend then passes this to the front end (originally a host-based console system and these days a website) for it to display.
The person when they look at the page has no idea what page# they are on, no idea how many pages or results there are, they can page up if there are previous pages and page down to get the next set of customers.
If they search for a customer, lets call the customer 'Fred', they type 'Fred' into the search box, this time, the backend using the sorting, filtering, etc... finds the customer 'Fred' in the customers table by doing a 'CustName >= Fred', this pulls out the first record that matches that search.
Then, starting with 'Fred' at the top of the page, gets the next X number of customers out to finish the page off (this could be 19 more customers, or there might only be 3 more customers after Fred), and sends it to the front end to display.
Now, at this point, the user has the ability to press the 'Page Up' key and if there is a customer before fred, it will show that on the bottom of the next page and go back X number of records to find out who should be shown at the top of the page.
So there is no restriction with going back and forth, the system just knows that when it has no more previous customers, it must obviously be at the first page.
Now with DataTables, is there any way to replicate this?
Basically: Type in a search, find the customer in the DOM table (that DT created), put the customer at the top of the page and show the next X customers, plus have the ability to go to previous pages and next pages, or am i stuck with the filtering style system?
If all DT is capable of is the filtering system then that honestly sucks, i can't change how the search currently works, its how our customers prefer it, it is how our admin staff prefer it and it is how our branch staff prefer it.
Answers
Basically you should be able to configure/customize/influence anything that DataTables do using the DataTables API and DataTables Events. If what you need is not visible in the 1st front line then you can go deeper down into jQuery and source codes - its all open source anyway.
The scenario that you describe looks to me like already supported by the Server-side processing
Can you narrow down your problem into a simpler code question? (with ready to run test case)
Server-side processing won't do what i need.
I can't actually guarantee the data will come back in the way that it is expecting looking at that webpage.
Problem is pretty simple (i would have thought anyway since i explained how it already works).
Server sends a JSON to the front end (which may consist of 20k records).
Datatables turns that into a table, which is what it currently does.
When a person types in a search, datatables should go find the row in question, position it at the top of the table and then show X number below it to fill the table out.
Then you can still navigate to previous pages and next pages based on the current positioning.
Can't really provide a test-case, not sure how i would do it on the datatables live site, and the system in question is a point of sale so i can't show you on the main site itself either.
I honestly don't know how to explain it, what I said seems so simple in terms of explanation.