RowGroup of column using custom rendering (AJAX)

RowGroup of column using custom rendering (AJAX)

matthew_bmatthew_b Posts: 5Questions: 1Answers: 1

Hi. I have a table populated with AJAX data that has a date column. I'd like to group the data in the table by month name, so I created a column that I setup as follows:

        {
            data: "startDate",
            visible: false,
            render: function (data) {
                return moment(data).format("MMMM");
            }
        }

My problem is that I can't see to figure out how to get rowGroup to group by the month name. When I try setting rowGroup to true (with the above column as my first column) or set it to the specific column number, nothing happens. I assume this is because I am using AJAX data. Is there a way to get this to work other than adding "month" to the database?

This question has an accepted answers - jump to answer

Answers

  • matthew_bmatthew_b Posts: 5Questions: 1Answers: 1
    Answer ✓

    I did eventually solve this myself. Rather than creating a column, I put the data to group by function as part of "rowGroup", for example:

    rowGroup: {
        dataSrc: function (row) {
            return moment(row.startDate).format("MMMM");
        }
    }
    
  • Ergin CelikErgin Celik Posts: 1Questions: 0Answers: 0

    @matthew_b Great ! It works fine. Now, need to combine with other rendering options to customize the row :)

  • stolstol Posts: 16Questions: 2Answers: 1

    Very helpful! Thank you.

This discussion has been closed.