RowGroup Not Working

RowGroup Not Working

rossbobrossbob Posts: 29Questions: 4Answers: 0

I have a rowGroup which is defined as such;

            rowGroup: {
                //className: 'vendor_details',
                emptyDataGroup: null,
                dataSrc: 'ps2.segment_title',
                // startRender: function ( rows, group ) {
                //
                //     return group +' ('+rows.count()+' rows)';
                // }
            },

I have a column definition in my datatable (same one that im attempting to do rowGroup on) which is as such;

{"data":"ps2.segment_title"}

The segment_title is displaying correctly in the table however, the rowGroup does not work for this value. If I change it to another value in my dataset, it works fine. The value that it does work for is derived from the main table whereas ps2 is derived from a leftJoin. Not sure if this is the reason why it suddenly doesnt work. Any help would be much appreciated.

This question has an accepted answers - jump to answer

Answers

  • rossbobrossbob Posts: 29Questions: 4Answers: 0

    This is the javascript error i get;

    Uncaught ReferenceError: that is

  • colincolin Posts: 15,112Questions: 1Answers: 2,583

    Sounds like a lot of stuff going on there. We're happy to take a look, but as per the forum rules, please link to a test case - a test case that replicates the issue will ensure you'll get a quick and accurate response. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.

    Cheers,

    Colin

  • rossbobrossbob Posts: 29Questions: 4Answers: 0

    Thanks Colin. Here it is;

    http://live.datatables.net/nolehowe/1/edit?html,css,js,output

    Getting JS errors when loading RowGroup. Seems odd given im not doing anything unusual. Let me know what ive done wrong.

  • kthorngrenkthorngren Posts: 20,139Questions: 26Answers: 4,735
    Answer ✓

    You are getting these two errors due to your JS load order. Datatabables needs to be loaded first.

    VM43 dataTables.editor.min.js:1 Uncaught Error: Editor requires DataTables 1.10.7 or newer

    Uncaught TypeError: Cannot set property 'RowGroup' of undefined

    Not sure this is valid syntax for rowGroup:

                rowGroup: function (row) {
                  return row.segment_title;
                },
    

    I changed it to this:

                rowGroup: {
                  dataSrc: 'segment_title'
                },
    

    It seems to work:
    http://live.datatables.net/duviyire/1/edit

    Kevin

  • rossbobrossbob Posts: 29Questions: 4Answers: 0

    Thanks Kevin. I that to start with but found some code somebody else published which used that method so I thought I give it a try.

    I assumed the order of the libraries loaded but i tried changing them around and it didnt seem to make any difference. To be honest, Its the first time ive used JSBin so not too familiar with it.

    So the fact that it is giving me similar behaviour in my app may be related. Ill have a look and see if this is the case. Thanks for your help.

  • rossbobrossbob Posts: 29Questions: 4Answers: 0

    Ok. Looks like that is definitely the issue. Ive managed to get it working. Now to get it working in my app. Thanks for the help.

  • kthorngrenkthorngren Posts: 20,139Questions: 26Answers: 4,735

    Looks like you can use a function for rowGroup.dataSrc, see the comments section. But in your case you were return the rowgroup option as a function which I don't think is supported.

    Kevin

This discussion has been closed.