Problem with filter in search pane

Problem with filter in search pane

Rawland_HustleRawland_Hustle Posts: 94Questions: 16Answers: 0

Link to test case: http://themeadow.se/ServiceProductions/
Debugger code (debug.datatables.net): afobab
Error messages shown: No error message show
Description of problem:

Hi,

I'm trying to make a filter in one of my search panes. I want to filter out records where column 5 (errorCode) == "VP009". For some reason my code below does not work. Any suggestions?

Thanks!

$('#errorTable').DataTable( {
        "ajax": {
           "url": "http://themeadow.se/ServiceProductions/cooperationErrors.php",
           "dataSrc": ""
        },
        "columns": [
            {"data": "@timestamp"},
            {"data": "waypoint"},
            {"data": "senderid"},
            {"data": "receiverid"},
            {"data": "tjanstekontrakt"},
            {"data": "errorCode"},
            {"data": "time_producer"},
            {"data": "log-level"},
            {"data": "serviceProducer_hsaId"},
            {"data": "serviceProducer_description"}
        ],
        searchPanes:{
            panes: [
                {
                    header: 'Missing in TAK',
                    options: [
                        {
                            label: 'Missing in TAK',
                            value: function(rowData, rowIdx) {
                                return rowData[5] == 'VP009';
                            }
                        }
                    ]
                }
            ],
        },
        columnDefs: [
            {
                searchPanes: {
                    show: false
                },
                targets: [0,1,2,3,4,5,6,7,8,9]
            }
        ],
        dom: 'Pfrtip'

    } );

This question has an accepted answers - jump to answer

Answers

  • kthorngrenkthorngren Posts: 21,300Questions: 26Answers: 4,945
    Answer ✓

    I think you need to change return rowData[5] == 'VP009'; to return rowData.errorCode== 'VP009';. Since you are using objects instead of arrays you will need to use object notation to access your data.

    Kevin

  • Rawland_HustleRawland_Hustle Posts: 94Questions: 16Answers: 0

    Thanks alot!

Sign In or Register to comment.