Column filter with object data

Column filter with object data

Deb3Deb3 Posts: 2Questions: 1Answers: 0

Hello,

I'm very happy to be able to replace our php/sql publication search with DataTables. I am not a web developer or programmer.

Here is the basic datatable page:
http://www.oregongeology.org/temp-deb/pubs/pubsearch_newdogami.htm

As a start to an advanced search, I am trying to allow filtering by Publication Series and by Year. Here is the page (not working) with the column filter script added:
http://www.oregongeology.org/temp-deb/pubs/pubsearch_newdogami_ColumnSearch.htm

I was able to get column filtering to work on this page, but the data here are in the html page:
http://www.oregongeology.org/temp-deb/rvs/reports.htm

Thank you for any help you can provide.

This question has an accepted answers - jump to answer

Answers

  • kthorngrenkthorngren Posts: 20,151Questions: 26Answers: 4,736
    Answer ✓

    If you look at the browser's console you will see this error:

    pubsearch_newdogami_ColumnSearch.htm:96 Uncaught SyntaxError: Unexpected identifier

    It refers to this area. You need to add a comma separator between your columns and initComplete options:

            "columns": [
                { "data": "series" },
                { "data": "series_no" },
                { "data": "title" },
                { "data": "author" },
                { "data": "year" }
            ]   <<<add comma here
            
            initComplete: function () {
                this.api().columns([0, 4]).every( function () {
    
    

    Kevin

  • Deb3Deb3 Posts: 2Questions: 1Answers: 0

    Thank you, Kevin! That fixed it; I did see the "Unexpected identifier" error, but as I have a tenuous grasp of JavaScript, the error was too vague for me to interpret.

This discussion has been closed.