• Resolved charlesgodwin

    (@charlesgodwin)


    I was unsure whether open many or one with a list. I’m going with a list

    1. It would be nice if the short code could extract values from the querystring (QS). For example if the QS was ?name='godwin' the shortcode could have a parameter such as sql_where="namefield = '$name'" so it would be expanded at run time.
    2. I would like to have a way to influence the initial load of the data. A metaphor, or perhaps the solution, is as if a value had been placed in the search field before the table is drawn. This is different than a predefined where clause as the where clause is “sticky” for all subsequent searches Perhaps a shortcode like search='godwin' or something similar.

      for example say you want the initial draw to just show records with Godwin in them. Since it would be the same as if I had opened the page and entered Godwin in the search field. After that any search would be fresh.

    3. And finally. How about a check box for Search previous results. This could be an alternative to supporting filters on each column. With this I could search for all Godwin and then all Charles in the Godwin set.

    I realize none of these are simple to implement so they are just ideas. I will not be offended if you reject them.

Viewing 11 replies - 1 through 11 (of 11 total)
  • Plugin Author Passionate Programmer Peter

    (@peterschulznl)

    Hi Charles,

    These are good suggestions. All of them! Let me go through them one by one.

    Q1) Great idea! Although I don’t think this can be implemented with a query string as the request is sent by the jQuery DataTables object. We need to add a query input field for every queryable column. I found a great solution here: https://stackoverflow.com/questions/48316191/jquery-datatables-set-default-search-value-for-a-column-when-initializing-a-tab
    I think the last suggestion is what you need. The one rates as -2 ;-)! Can you check the example?
    I added your request to my to do list. I’ll let know when it is available.

    Q2) You can use column “Table options (advanced)” in the Data Publisher to add an initial search value. There are two ways to do this:
    (1) {“processing”:false,”stateSave”:false,”search”: {“search”: “godwin”}}
    (2) {“serverSide”:false,”processing”:false,”stateSave”:false,”searchCols”:[{“search”:”godwin”},null,null]}
    The first option adds a global search. The user will see the search value in the search box. The search value can be change by the user.
    The second option adds a column specific search value. In this example the search value will be used for the first column only. You can add multiple search values. These search values cannot be change by the user and would the same as adding a default where. In combination with the solutions I mentioned below Q1 however, this is giving you the possibility to let a user search on individual columns. Make sure that the number of columns in your options matches the number of columns selected in your publication. You can use the links below for more information about these options.
    https://datatables.net/reference/option/search
    https://datatables.net/reference/option/searchCols

    (Q3) I’ve planned to add more features to this area this year. I will keep you posted.

    Two final notes:
    NOTE1) If you want to experiment with Q2 option 2, you’ll need to update your plugin version. I had to patch the current release (2.7.3) to fix the serverSide=false request. Make sure you don’t delete all plugin tables and options (manage plugin > uninstall settings) if you need to remove the plugin first. Otherwise you will lose all your settings (including projects, publications, and so on).
    NOTE2) This month I will release version 3 which supports remote database access! Just wanted to mention as I know you’re waiting for that feature… ??

    Thank you for all your wonderful feature requests!

    Best regards,
    Peter

    Thread Starter charlesgodwin

    (@charlesgodwin)

    I don’t know if this is a 4 or a variation on 1 and 2.

    It would really be nice to open a page with a dynamic search value preloaded. The value I have in mind is dynamic. It could be implemented as either a query string or a value in session data. For example if a user filled in a form with a name of “jones” and pressed Submit and the data table page would open with a search of Jones.

    Another application is the front end table maintenance in Data Project. Currently, if a user uses search to find some records, selects one to edit, completes the update and then presses Back to List the search is gone and must be repeated. The Back button works but gets a refresh message, at least in chrome. Dynamically loading or retaining the search value in this case would be very user friendly.

    Thaks, keep up the good work.

    Plugin Author Passionate Programmer Peter

    (@peterschulznl)

    Hi Charles,

    Just wanted to let you know that version 3 is out and allows you to add your own search logic through a shortcode. More info can be found here:
    https://wpdataaccess.com/2020/01/29/filter-wpda-construct-where-clause-to-add-custom-search-behaviour/

    Let me know if you need help.

    Best regards,
    Peter

    Thread Starter charlesgodwin

    (@charlesgodwin)

    Thanks Peter. Keep up the good work.

    The link provided points to the custom where clause topic but does not cover “add your own search logic through a shortcode”

    Second question:
    Have made a decision on if or when for Q3?

    I am planning to experiment with your original answer for Q2 now that I have time.

    Thread Starter charlesgodwin

    (@charlesgodwin)

    This is probably a dumb question but JavaScript is not one of my strong languages – yet.

    I did some research into Q2 and column filter

    I read this page https://datatables.net/reference/api/columns().search()

    And the second example is what I want to test. Of course the example uses #example and I need to replace it with the proper id for my published table.

    the table i’m publishing is named library_public. There are, in the generate WP page ids starting with library_public1. I’ve tried every iteration if #library_public1… I can think of but fail.

    I’m sure I’m missing something obvious, but what?

    thanks to all in advance.

    Plugin Author Passionate Programmer Peter

    (@peterschulznl)

    Hi Charles,

    Is this page online? Maybe I can help if I can have a look at it…

    Thanks,
    Peter

    Thread Starter charlesgodwin

    (@charlesgodwin)

    Thread Starter charlesgodwin

    (@charlesgodwin)

    Any luck. Does column search need any server side work? or..?

    Plugin Author Passionate Programmer Peter

    (@peterschulznl)

    Hi Charles,

    There is an example on the jQuery DataTables website:
    https://datatables.net/examples/api/multi_filter.html

    This example works client side. The plugin performs all queries server side. I think your right and it does require server side work to handle those specific queryable columns.

    Best regards,
    Peter

    Thread Starter charlesgodwin

    (@charlesgodwin)

    If it’s server side work, it looks like it will be non-trivial. Should I consider this a great learning experience or can you point me in the right direction? Thanks

    Plugin Author Passionate Programmer Peter

    (@peterschulznl)

    I’ll have a look at it and let you know! ??

    Best regards,
    Peter

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Change requests’ is closed to new replies.