Fixed bug for search filters to output number of records found

pagination-support
Glenn Wilkinson 2020-10-24 12:01:08 +02:00
parent fe3fd9516d
commit 81c979886d
1 changed files with 1 additions and 1 deletions

View File

@ -132,7 +132,7 @@ func (as *Server) Group(w http.ResponseWriter, r *http.Request) {
} else { } else {
// Handle pagination for DataTable // Handle pagination for DataTable
gs, _ := models.GetGroupSummary(id, ctx.Get(r, "user_id").(int64)) // We need to get the total number of records of the group gs, _ := models.GetGroupSummary(id, ctx.Get(r, "user_id").(int64)) // We need to get the total number of records of the group
dT := models.DataTable{Draw: draw, RecordsTotal: gs.NumTargets, RecordsFiltered: gs.NumTargets} dT := models.DataTable{Draw: draw, RecordsTotal: gs.NumTargets, RecordsFiltered: int64(len(g.Targets))}
dT.Data = make([]interface{}, len(g.Targets)) // Pseudocode of 'dT.Data = g.Targets'. https://golang.org/doc/faq#convert_slice_of_interface dT.Data = make([]interface{}, len(g.Targets)) // Pseudocode of 'dT.Data = g.Targets'. https://golang.org/doc/faq#convert_slice_of_interface
for i, v := range g.Targets { for i, v := range g.Targets {
dT.Data[i] = v dT.Data[i] = v