• Resolved edudude

    (@edudude)


    Hi! Sorry to ask your advice again, because I’m not sure if this is a bug or not.

    The search functionality doesn’t seem to work that well with Google Sheets table. First of all it seems to take a long time from pressing the ‘search’ button and it actually finding it or not. This may be due to it being a Google Sheets table and not locally imported file. This also affects so that real-time search is out of the question unfortunately.

    The second thing is that it doesn’t seem to search from all the columns in the table, only the first column. So when I, for example, search for the ‘2023’ in the ‘Vuosi’ (year in Finnish), it doesn’t find anything, even though there are rows that contain ‘2023’.

    Third and more crucial is that the search functionality doesn’t seem to work when not logged in as a site/wordpress admin (e.g. in incognito mode)

    I don’t have cache add-on installed any more, so it shouldn’t be because of that.

    Thanks again. Even though I’ve had problems with it, I think it’s a great add-on!

    The page I need help with: [log in to see the link]

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter edudude

    (@edudude)

    Update:

    I noticed the search function works when using my Iphone SE. It doesn’t however work when using my family’s old PC regardless of browser (tried Edge, Chrome, Mozilla).

    Using Mozilla, the dev tools console displayed this error message:

    Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://vselokuvakeskus.fi/wp-admin/admin-ajax.php. (Reason: CORS header ‘Access-Control-Allow-Origin’ missing). Status code: 200.
    
    failed searchTable wibergsweb188.js:1074:21
    
    Object { readyState: 0, getResponseHeader: getResponseHeader(e), getAllResponseHeaders: getAllResponseHeaders(), setRequestHeader: setRequestHeader(e, t), overrideMimeType: overrideMimeType(e), statusCode: statusCode(e), abort: abort(e), state: state(), always: always(), catch: catch(e), … }
    wibergsweb188.js:1075:21
    
    

    When reloading the page:

    Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://vselokuvakeskus.fi/wp-admin/admin-ajax.php?action=getdefaults. (Reason: CORS header ‘Access-Control-Allow-Origin’ missing). Status code: 200.
    
    failed getdefaults wibergsweb188.js:21:17
    
    Object { readyState: 0, getResponseHeader: getResponseHeader(e), getAllResponseHeaders: getAllResponseHeaders(), setRequestHeader: setRequestHeader(e, t), overrideMimeType: overrideMimeType(e), statusCode: statusCode(e), abort: abort(e), state: state(), always: always(), catch: catch(e), … }
    wibergsweb188.js:22:17
    

    Here’s the whole message when using Edge dev tools:

    jquery-migrate.min.js?ver=3.4.1:2 JQMIGRATE: Migrate is installed, version 3.4.1
    elokuvakerhopalvelu/:1  Access to XMLHttpRequest at 'https://vselokuvakeskus.fi/wp-admin/admin-ajax.php?action=getdefaults' from origin 'https://vselokuvakeskus.net' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
    wibergsweb188.js?ver=6.4.3:21 failed getdefaults
    wibergsweb188.js?ver=6.4.3:22 {readyState: 0, getResponseHeader: ?, getAllResponseHeaders: ?, setRequestHeader: ?, overrideMimeType: ?,?…}
    jquery.min.js?ver=3.7.1:2 
            
            
            GET https://vselokuvakeskus.fi/wp-admin/admin-ajax.php?action=getdefaults net::ERR_FAILED 200 (OK)
    send @ jquery.min.js?ver=3.7.1:2
    ajax @ jquery.min.js?ver=3.7.1:2
    (anonymous) @ jquery-migrate.min.js?ver=3.4.1:2
    e.<computed> @ jquery-migrate.min.js?ver=3.4.1:2
    (anonymous) @ wibergsweb188.js?ver=6.4.3:9
    e @ jquery.min.js?ver=3.7.1:2
    t @ jquery.min.js?ver=3.7.1:2
    setTimeout (async)
    (anonymous) @ jquery.min.js?ver=3.7.1:2
    c @ jquery.min.js?ver=3.7.1:2
    fireWith @ jquery.min.js?ver=3.7.1:2
    fire @ jquery.min.js?ver=3.7.1:2
    c @ jquery.min.js?ver=3.7.1:2
    fireWith @ jquery.min.js?ver=3.7.1:2
    ready @ jquery.min.js?ver=3.7.1:2
    P @ jquery.min.js?ver=3.7.1:2
    elokuvakerhopalvelu/:1  Access to XMLHttpRequest at 'https://vselokuvakeskus.fi/wp-admin/admin-ajax.php' from origin 'https://vselokuvakeskus.net' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
    wibergsweb188.js?ver=6.4.3:1074 failed searchTable
    wibergsweb188.js?ver=6.4.3:1075 {readyState: 0, getResponseHeader: ?, getAllResponseHeaders: ?, setRequestHeader: ?, overrideMimeType: ?,?…}
    jquery.min.js?ver=3.7.1:2 
            
            
            POST https://vselokuvakeskus.fi/wp-admin/admin-ajax.php net::ERR_FAILED 200 (OK)
    send @ jquery.min.js?ver=3.7.1:2
    ajax @ jquery.min.js?ver=3.7.1:2
    (anonymous) @ jquery-migrate.min.js?ver=3.4.1:2
    e.<computed> @ jquery-migrate.min.js?ver=3.4.1:2
    searchTable @ wibergsweb188.js?ver=6.4.3:1014
    (anonymous) @ wibergsweb188.js?ver=6.4.3:843
    dispatch @ jquery.min.js?ver=3.7.1:2
    v.handle @ jquery.min.js?ver=3.7.1:2
    
    • This reply was modified 9 months ago by edudude.
    Plugin Author wibergsweb

    (@wibergsweb)

    Hi there!

    The main issue is that your server is not allowing requests from other domains. This is a “security”-feature that means not anyone should be able to access your data just by sending a “fetch my data command” (from javascript which is used to fetch data without reloading page). This feature/rule is called “Cross-Origin Requests (also known as CORS).

    You have status 200 which means you can reach the domain/site but Cross-Origin-Requests Blocked means you’re not allowed to fetch data from an external source:

    Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://vselokuvakeskus.fi/wp-admin/admin-ajax.php. (Reason: CORS header ‘Access-Control-Allow-Origin’ missing). Status code: 200.

    It’s possible to open this, but this has to be done on the server where your page is hosted, so it’s your hosting company you need to talk to.

    Because you get above error, you get an error in searching.

    If you fix this in collaboration with your host, the search-functionality will hopefully work as expected.

    • This reply was modified 9 months ago by wibergsweb.
    • This reply was modified 9 months ago by wibergsweb.
    • This reply was modified 9 months ago by wibergsweb.
    Plugin Author wibergsweb

    (@wibergsweb)

    If you want to speed up things (when you get it work as expected) you could use a setting/attribute called fetch_inteval.

    As default the plugin fetches content (from your googlesheet) in realtime, converts it a csv-file and then renders it to a html-table.

    But there is a setting created for fetching within certain intervals and it’s fetch_interval:

    fetch_interval – Set to daily, hourly or weekly. This is how often the actual fetch from source is done. so if you add fetch_interval=”hourly” it would only fetch once an hour. You MUST have html_id set for the table because a local file based on it’s html-id is stored to keep the cached file. If one hour hasn’t elapsed, then it renders the table directly from your local cached file. This locally (on the server where you host your site) cached file is stored in a folder called csvtohtml-arrs within your uploads-folder.

    Plugin Author wibergsweb

    (@wibergsweb)

    Because I didn’t hear anything from you for almost two weeks I guess the issue is solved, so I set this question as resolved.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Search functionality has some problems’ is closed to new replies.