rowgrouping issue

rowgrouping issue

tcomtomtcomtom Posts: 1Questions: 0Answers: 0
edited January 2019 in Free community support

Hi guys,
need some help with this.
I'm trying the rowgrouping but it's not grouping at all. i don't get any errors which makes it harder to troubleshoot.

Here is the code and the json file I'm using.

 var bvtable = $('#bvTable').DataTable({
            scrollY: 600,
            "ajax": "data_new.json",
            "columns": [
                {
                    "data": "data.patient.pat"
                },
                {
                    "data": "data.patient.name"
                },
                {
                    "data": "id"
                },
                {
                    "data": "bv_date_submitted"
                },
                {
                    "data": "bv_completion_date"
                },
                {
                    "data": "all_status.2"
                },
                {
                    "data": "reverify_date"
                },
                {
                    "data": "next_step"
                }
            ],
            order: [[0, 'asc']],
            rowGroup: {
                dataSrc: "data.patient.pat",
                startRender: function(rows, group) {
                    var patient = rows.data()[0]['data']['patient']['name'];

                    console.log(patient);

                    return $('tr')
                        .append("<td><a href='#' class='column-filter' data-filter='" + group + "'>" + group + "&nbsp;<i class='fa fa-filter'></i></a></td>" )
                        .append("<td colspan='9'>" + patient + "</td>");
                }
            }
        });

JSON FILE FORMAT:

"data": [{
        "id": "1-100037168111",
        "type": {
            "code": 3,
            "name": "PA Denied - Generic Coverage Only",
            "action": " - "
        },
        "date": "11/26/2018",
        "date_full": "2018-11-26T12:59:17.082Z",
        "bv_date_submitted": "03/14/2018",
        "pa_date_submitted": "12/14/2017",
        "days_in_process": 42,
        "reverify_date": "2020-01-07T14:17:34.104Z",
        "bv_completion_date": "2019-02-09",
        "next_step": [" - "],
        "all_status": ["Covered - If insurer guideliens are met", " - ", "PA Denied - Generic Coverage Only"],
        "data": {
            "patient": {
                "pat": 9633061201,
                "name": "Bryana Crona",
                "sex": "Male",
                "DOB": "06/04/1973",
                "SSN": 572221760,
                "address": "9519 Kuhlman Valleys, East Gaymouth, AZ 80936",
                "email": "caleb27@yahoo.com",
                "primary_phone": "107-739-0860",
                "alternate_phone": "826-062-1862",
                "hipaacompleted": "08/25/2018",
                "hipaaexpire": "02/16/2018"
            },
            "physician": {
                "name": "Marta McClure",
                "NPI": "90432264",
                "tax_id": "LT800706797090580719",
                "ptan": 554863189,
                "email": "lonnie22@hotmail.com",
                "phone": "284-815-7447",
                "fax": "128-710-5386"
            },
            "insurance": {
                "type": "Health Insurance",
                "company": "Kilback LLC",
                "phone": "139-052-9554",
                "member_id": 817584244,
                "group_id": 186542586
            },
            "facility": {
                "name": "Sipes - Considine"
            }
        }
    },

Replies

  • kthorngrenkthorngren Posts: 21,307Questions: 26Answers: 4,947
    edited January 2019

    I'm trying the rowgrouping but it's not grouping at all

    There are no errors but what, if anything, happens with the table?

    Do you have the rowGroup extension (JS and CSS) files loaded?

    Looks like return $('tr') should be return $('<tr/>').

    Is "pat": 9633061201, a repeated value to group on?

    You have:

                    .append("<td><a href='#' class='column-filter' data-filter='" + group + "'>" + group + "&nbsp;<i class='fa fa-filter'></i></a></td>" )
                    .append("<td colspan='9'>" + patient + "</td>");
    

    Which totals 10 columns but it looks like you have only 8 in the table.

    If this doesn't help then please provide a link to your page or a test case replicating this issue.
    https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case

    Kevin

This discussion has been closed.