WordPress.org

Ready to get started?Download WordPress

Forums

TablePress
[resolved] Filter Rows if Cell in Specific Column Contains 0 (8 posts)

  1. DavidWeba
    Member
    Posted 3 months ago #

    Hey Tobias, thank you so much for creating such an amazing plugin. And thank you for creating the time to create such useful extensions for TablePress too!

    I'm actually having a few problems getting the features I want in place but this one is most crucial.

    I maintain a master inventory sheet through Google Drive that I am currently publishing and importing into TablePress. I would love if my viewers had a way to filter out quantity that we no longer have in stock, since they would be able to purchase it. I had to create a Google Apps script that automatically copys our sheet into a separate spreadsheet and remove all duplicates, but that's a pain and currently still has a few bugs to kink.

    Essentially, I'm looking for a way to Filter Rows if a Cell in Specific Column Contains 0. I would like for this to be automatically done by the Table upon loading or have a checkbox to switch to a view without items with quantity of 0 being visible.

    You can view my website in progress @ http://tech4lesswholesale.com/

    Thank you so much!

    https://wordpress.org/plugins/tablepress/

  2. TobiasBg
    Member
    Plugin Author

    Posted 3 months ago #

    Hi,

    thanks for your post, and sorry for the trouble.

    The best chance that I see here is to use the Row Filter Extension from http://tablepress.org/extensions/row-filter/ for this, either directly or as a starting point for your own customizations.

    That Extension, by default, only searches "positives", i.e. it will show all rows that match the filter, but it should not be that difficult to reverse that behavior for your custom case.

    Regards,
    Tobias

  3. DavidWeba
    Member
    Posted 3 months ago #

    Thank you for your quick response,

    Ahh I figured as much, while my PHP skills are severely lacking I'll look into editing that extension. I do like that everything is commented, so in theory it should be easy, but as I said I am quite the novice.

    I have a few other problems that I am trying to work out, some of which are bugs present in TablePress. Do you mind if I quickly ask you them all in this thread for a quick response on each? I would really appreciate it!

    Bugs
    1) Fixed Headers on Table Overlap Tippy Tooltips

    I tried editing the z-index on the wordpress plugin "Tippy" but no matter what, the fixed headers on the table overlap the tooltip. I suspect this is the way the Table Headers are being rendered. You think you have a quick CSS fix for this? :-)

    2) Search breaks Fixed Header on Theme (Fruitful) if Symbol is used

    I used to have my theme's "sticky header" enabled along with "datatables_tabletools_fixedheader_offsettop=130" in order for the Table Headers to appear below the Page Header (speaking of which, I tried to accomplish this myself but luckily I found a post where you implemented this feature in, thanks!) so my visitors can access the menu at any time without having to scroll up, but I realized that the search in TablePress somehow disables this function completely if a symbol is used in a search (e.g. AT&T). Very weird bug.

    3) Fixed Headers on reload of page are in the wrong position, instantly correct when scrolled

    I have no idea why it's doing this. It seems to never replicate this error upon the first load, but after each reload the Headers hover a few pixels where they actually should be, covering up other elements in the process. The second a user scrolls, they snap right back into place.

    Requests
    1) Left to Right Positioning of Column Filter Widgets

    I'm currently using float:right which reverses the order, I know this is a novice issue but I have tried everything to get the widget to show up on the right side of the page and in the correct order.

    2) Bold First Unique Cell in a Column (e.g. Multiple BlackBerry entries, only first one bold)

    I just want to know if this is feasibly possible. I'm looking for a way for visitors to quickly identify while scrolling for a particular brand. Alternatively, what I'm really looking for is the functionality that books have had since the dawn of time, "Chapters" if you will that quickly identifies where you are on the spreadsheet. Having the same Brand (Apple, Samsung, etc) repeated throughout the spreadsheet makes it hard to quickly identify a unique entry.

    3) Visually Labeling TableTools Functions
    I love the Table Tools function! But I want my visitors to be able to identify with the buttons. I did have text awkwardly spaced above the buttons as a quick fix, but I would love a better alternative for labeling these guys so the average visitor can identify what each button does.

    THANK YOU AGAIN TOBIAS! Besides these few issues and requests, I am extremely satisfied and grateful for the time you have spent managing this plugin and especially the patience you express with us noobs :-)

  4. TobiasBg
    Member
    Plugin Author

    Posted 3 months ago #

    Hi David,

    good to hear that you find those Extensions useful! :-) Now, as those are Extensions that rely on features/add-ons for the DataTables JS library (which I didn't develop), my knowledge on their internals is limited, so I might not have satisfying answers on all of the questions, but I'll try:

    For 1) and 2): Here, it would be good if I could take a look at a table where this happens. For 1), I assume that it's some z-index issue, indeed. For 2), I don't really have an idea yet.

    For 3): Yes, I have seen that somewhere else before, and I assume that the FixedHeaders JS code has problems determining the position correctly, as some elements on the page might (or might not) be cached in the browser cache, which could lead to quicker loading on some of them, which then might result in quick position changes.
    This will probably need to be addressed in the FixedHeader JS code directly.

    For 1) on the ColumnFilterWidgets: That should be possible by setting the display property on the <div>s and <select>s to inline. That would allow to get rid of the float (for which I don't remember why it's in there) altogether, and then use text-align:right; on the outer <div>. Can you maybe experiment with this in Firebug or the Chrome Developer tools?

    For 2): I don't really see an automated way for this. :-( It might be the best to solve this with some inline HTML on that first entry in the column.

    For 3): The TableTools buttons can be customized (e.g. to also have text labels), see https://datatables.net/extras/tabletools/button_options Those settings would have to adjusted in the PHP file of the Extension, which basically generates the JS code for those options.

    Regards,
    Tobias

  5. DavidWeba
    Member
    Posted 3 months ago #

    Thank you for your response! Excuse me for my late reply, been busy with work.

    I was actually able to find a function within DataTables that can accomplish my original request of "Filtering Rows if Cell in Specific Column Contains X" called $.fn.dataTableExt.afnFiltering.
    http://datatables.net/examples/plug-ins/range_filtering.html

    I have not yet implemented this into TablePress, nor do I know how, but I'm actively looking into it.

    As for Bug #1 you can visit this test page I made:
    http://tech4lesswholesale.com/tobias-test/

    Bug #2 fixed itself somehow, must have been some code somewhere conflicting with the fixedheader. I actually have decided to permanently disable the theme's fixed header for now to conserve vertical space on lower resolution computers.

    Bug 3# is low priority and I guess I can ignore it for now.

    As for my requests, thank you for your input! I was able to accomplish Request #3 with "sToolTip", keeps the site looking clean :)

    Your suggestions for Request #1 didn't help I'm afraid, maybe it's because I'm not editing either <div> or <select>? I added those values inside TablePress's Plugin Options, which looks like:

    .column-filter-widget {
    	display: inline;
    	text-align: right;
    }

    On my site, float: right; exists just to get the filtering to appear on the right side of the page instead of the left. The problem is of course, when using float it reverses the order of the filtering from left-to-right to right-to-left.

  6. TobiasBg
    Member
    Plugin Author

    Posted 3 months ago #

    Hi,

    good to see that we are making progress here :-)
    And thanks for the test page!

    For Request #1, please try this "Custom CSS" instead of what you have now:

    .column-filter-widgets {
        float: right;
    }
    .dataTables_filter {
        clear: both;
    }

    Regards,
    Tobias

  7. DavidWeba
    Member
    Posted 3 months ago #

    Great! That fixed it! I'm learning more and more CSS tricks by the day :]

    Hey, this post from two months ago makes it sound like TablePress already includes the $.fn.dataTableExt.afnFiltering function?
    https://wordpress.org/support/topic/filter-does-not-work-fndatatableextafnfilteringpush?replies=4

    Is there a way to call this within TablePress already or will it need to be implemented through an extension?

    Thank you so much for your help so far!

  8. TobiasBg
    Member
    Plugin Author

    Posted 3 months ago #

    Hi,

    good to hear that that worked! :-)
    $.fn.dataTableExt.afnFilteringis an API function of the DataTables JS library that TablePress uses, so yet, in some way it's included.
    You will however need to call this API function manually (with the code from the DataTables website). As that code needs to go in a certain place, an Extension should be the best way.

    Regards,
    Tobias

Reply

You must log in to post.

About this Plugin

About this Topic