Know length of set used as field in ajax call

Know length of set used as field in ajax call

lucacali87lucacali87 Posts: 30Questions: 10Answers: 2

Hi, I use ajax to fill values inside my datatable. One of this field is an Set<> so I would like to show the number of elements in this structure.
This is my code

columnDefs: [
     {
         targets: 4,
         orderable: false,
         searchable: false,
     }
],
 //fix problem with responsive table
 "autoWidth": false,
 "ajax": "table",
 "columns": [
             { "data": "name" },
             { "data": "releaseDate" },
             { "data": "note",
                 "defaultContent": ""//this set empty string if clientVersion.name is null, otherwise datatables shows popup message with error
             },
             { data: "users.size()" 
             },
             { 
                 data: null,
                 className: "center",
                 defaultContent: '<button type="button" class="btn btn-danger" id="deleteVersion" data-toggle="modal"'
                     +'data-target="#deleteVersionModal">Delete</button>'
             }
],

Is there a way to show the elements number? Thanks

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 61,848Questions: 1Answers: 10,134 Site admin

    What is a Set<>?

    What is the JSON structure that table returns?

    Allan

  • lucacali87lucacali87 Posts: 30Questions: 10Answers: 2
    Answer ✓

    It works, it was a problem with json because my colleague annotates users field with @JsonIgnore so this field didn't exist in my json. I'm sorry but I can't delete the question

This discussion has been closed.