Custom Function Filter ordering on YADCF - yadcf

First of all, thank you so much for your support of YADCF. It's a fantastic tool! Second, I'm not a programmer (I know enough to break stuff :D) so I apologize in advance for having to bother you at all. It's possible my question has even already been answered, I just don't know what to search for.
I'm using the YADCF 0.8.8 table on DOM Source (small "d"). I've built a custom_func_filter based on 11 values & labels. The weird thing is, when the drop-down menu displays for the filter, the labels are not in the order they're defined in.
In trying to figure out what the issue was, I changed the values and labels to numbers from 01 - 11 instead of text to see how it was moving things around. Apparently it's anything over 10 items that it begins to jumble everything up. Here's a side-by-side comparison on what it looks like:
custom_func_filter comparison
I'm behind a firewall so it's not easy to share my code, but I'll figure out a way to if need be. I just wasn't sure if there was something I was missing.
Using datatables 1.9.4, jquery 1.11.3.
Thank you!

You are welcome :)
Quick answer: Use the sort_as: "none" and make sure the data array is in your desired order
Explanation: BEcause in custom function filtering the select is being populated by (data) array of objects value/label the sort as (as its implemented now) wont really sort the data, so since you populate data manually, just make sure its in your desired order

Related

Vue 3 Better performance of lot of DOM elements

I have a big fat sort of table with lots of elements that make it really buggy.
For context 1 row per user, each user has X projects and each project has 3 month of day display (sort of gantt)
So I built something cool it's working great, but if I scale to more users it begin to be real buggy.
I'm implementing filter to display less users but at some point it need to handle the limit that I have now without being buggy.
What I found is when I'm updating a day it re-render the whole Gantt which is really stupid.
here is a minimal reproduction link: https://stackblitz.com/edit/vitejs-vite-g6azah?file=src%2FApp.vue&terminal=dev
As you can see when I'm updating an input with the v-model:
value.value
I have the attribute with the function
:test="testRerender()"
That trigger for the whole Gantt and I believe it is the issue here.
I saw v-memo that look like what I need but I can't figure out with the doc how can I use it to match my needs (and there is almost no good article on it)
Thanks for your help you would save my life!
I tried to filled proper :key attribute, code optimization, v-memo etc...

Using a DelegatingStyledCellLabelProvider with an ITableLabelProvider

I am trying to style specific cells in my table that have a specific attribute. I have used a DelegatingStyledCellLabelProvider in the past for a Tree structure, and was hoping to do the same here.
However, I can't figure out how to get it working with my ITableLabelProvider.
I saw questions like this one that suggested using IColumnLabelProviders instead of the ITableLabelProvider, but I really don't want to go back and change my code.
Is there anything I can do?
DelegatingStyledCellLabelProvider will not work with the old style ITableLabelProvider as it does not support multiple columns. You must use separate column label providers.

How to search an entire column for one or two keywords

I am in the process of creating a program, using Visual Basic Express, for a physics professor who has recently had to rename all 1500 questions for his course. I created a database that has the old names, new names, and the entire contents of each question. The program seemed an easy enough idea, but has proved to be very difficult for me. I am new to programming (this is only my third go at it) and have searched for an answer to my problem for at least 20 hours, and have yet to find anything that will work for what I need.
What I would like is to have a text box in which he can type in a keyword (such as "Sun", "ISS", "Force", etc) and for the program to search throughout the entire "questioncontents" column and pull out any questions that contain those words into the datagrid. As of yet the closest I have gotten is for it to search the first word of the column, which is not very useful since most of them start with "The".
I had also thought of creating several keyword columns and then just having it search through those, but I couldn't figure out how to apply the filter to multiple columns.
This may be a stupid question, and if so I apologize, but I am desperate to figure this out as the semester begins relatively soon and I would like to show him how to use it before classes start. Any suggestions or help would be very greatly appreciated.
According to my understanding of the question:
SELECT * FROM question WHERE questioncontent LIKE '%SUN%';
As simple as that, you just have to replace SUN in the above query with the value entered in the textbox

Insert items into alphabetical sections in tableview

So, I have an array of various names and I have populated the table with section headers
A-Z.
Is it correct to find the first char of my data and then subsequently put it in the correct section, or is there a way to do it using a faster method.
I believe what I am doing is wrong as I am thinking of making an A array for example and then find every element starting with 'A' and insert it inside. But this is a bit crazy as then, I would need to create A-Z arrays which I seriously do not think that is the correct way.
I'm sorry if this is posted in the documentations but I don't seem to be able to find it.
Any help from you guys in this matter?
Well I actually did it this way, too and I don't see any reasons why this shouldn't be done, as it decouples the fetching / sorting process from refreshing the tableview, which in turn keeps loading and scrolling the tableview smooth.
Having A-Z arrays is not a big issue memorywise since they're just holding references to your data objects anyway and not the data itself. But it allows you fast access to your data objects without the need for expensive comparison operations.
Just make sure your arrays are kept up to date if data objects are added or deleted.

Business Applications: What are the fundamental features of a search form?

In a typical business application it is quite common to have forms that are used for searching.
Some basic features are:
A pane that contains the search criteria
A grid to display the results
Sorting on the grid
A detail page that opens when an item is selected in the results grid
What other features would you expect in a business application's search functionality?
Maybe it's a bit trite but there is some sense in this picture:
removed dead ImageShack link
Do it as it shown at the second example, not as at the 3rd one.
There is a well known extreme programming principle - YAGNI. I think it's absolutely appliabe to almost any problem. You always can add something new if it's necessary, but it's much more difficult to remove something what is already exist because someone already uses it even if it's wrong.
How about the ability to save search criteria, in order to easily re-run a search later. Or, the ability to easily, cleanly, print the list of results.
If search refining is allowed (given a search result, limited future searches to the current results), you may also want to add a breadcrumb system, so that the user can see the sequence of refinements that lead you to the current result-set -- and by clicking on a breadcrumb, return to a previous refinement stage.
Faceted search:
(source: msdn.com)
This is displayed in the area in the right ellipse. There are filters and the engine shows the number of results that will remain after aplying the filter. This is very useful and can be done without pain in some search engines, such as Apache Solr. Of course, implement this only if filters make sense in your task.
Aggregate summary info, like total(s), count(s) or percentages.
One or more menus, like right click context for the grid, a ribbon or menu on top.
Your list for the UI elements is kinda good. Export, print (asking them whether it is really necessary to print this?), category/tag and language selection is worth to consider. Smart and working pagination (don't forget ordering).
Please do not force a search to open in a new (or even worse, always in the same window). Links of search results should be copy-pastable (always use GET),
But it really matters to have a functional (i.e. a really good) algorithm. Mostly I google company websites, because their search engine is, cough, awwwwkward. Looking for a feature chart, technical spec, pricing etc. one is not interested in press releases and vica-versa.
Search engine providers offer integration into company websites.
Use Auto-complete wherever possible on your text input fields.
If using selects or combo boxes with related information try and use chain selects to organise the information.
Where results depend on location try and serve relevant results.
Also remember to keep the search form as simple as possible even down to one text field. To refine the search you can have an alternate form as an "Advanced Search interface".
Printing, export.
A grid to display the results
Watch out not to display results a user is not authorized to see (roles / permissions / access rights).
A detail page that opens when an item is selected in the results grid
In case a user attempts to circumvent the search page links and enter some document directly, again, check out for permissions.
Validation, validation, validation.
It should be very hard, near impossible, for me to run a query that makes no sense. ie, start date occurring after an end date.
Export a numerical dataset (even if it only has one numeric column - so just make it so by default) to CSV for import into Excel (people love this function, even if only 1% of users seem to use it with any regularity. Just ask yourself when's the last time you highlighted something for copy-n-paste. Would it have been easier to open a CSV?
Refinable searches (think Google's use of site: -). People who use the search utility a lot will appreciate this. People who don't won't know it's not there.
The ability to choose to display 1 records, 5 records, 100 records, 1000 records, etc. "Paging" I believe is what we most commonly call it ;).
You mentioned sortable grids. Somebody else mentioned auto-sum or auto-count. Those are good if (once again) you have largely numeric data. But those are almost report-oriented functions.
Hope this helps.
One thing you can do is have a drop down of most common searches in plain english. e.g. "High value sales in New York in last 5 days". This is the equivalent of user selecting an amount, the city, date ranges etc. done conveniently for them.
Another thing is to have multiple search criteria tabs based on perspective of the user. Like "sales search", "reporting search", "admin search" etc.
ALso consider limiting the number of entries retrieved in the search and allow users to do more narrow searches. This depends on the business needs however.
The most commonly used search option listed first and in a prominent location.
I think your requirements are good. Take a cue from Google. Google got it right. One text box where you type whatever you want, and your engine spits out the answers. Most folks will try this, and if the answers are good enough, then that is what they will use. In the back-end, you'll probably want to flatten all of the data into a big honkin' table and then index it or use a SQL query with "LIKE" in it.
However, you will probably want to allow the user to refine the search. For this, have a link to "Advanced Search" and use a form there to specify filter criteria. This lets the user zero in on the results if basic search is not good enough. For the results on th is page, you will certainly want to have sorting on key fields, but do it after you have produced the initial result set.
It depends on the content that you are searching for.. make it relevant :) Search always look easy but can be incredibly difficult to get right.
Not mentioned yet, but very important I think - a search that actually works. This item is often neglected and makes the rest a bit moot.