darrachequesne / spring-data-jpa-datatables

Spring Data JPA extension to work with the great jQuery plugin DataTables (https://datatables.net/)
Apache License 2.0
451 stars 172 forks source link

Global Search with Entity Join #97

Closed jamesavilla closed 5 years ago

jamesavilla commented 5 years ago

Global search not searching against join table when searching on user entity when its onetomany. The field is below...

In the user_bp table I have a field bpcName that I would like the global search to search on also.

@JsonView(DataTablesOutput.View.class) @OneToMany(cascade = {CascadeType.ALL}, orphanRemoval=true, fetch = FetchType.EAGER) @JoinColumn(name = "user_id",nullable=false) @OrderBy("bpcName ASC") public Set<UserBP> userBp;

My datatables js is as follows for this field which displays correctly but does not search on bpcName...

{ data: 'userBp.bpcName', render: function(data, type, row) { console.log(row['userBp'][0]); return row['userBp'] ? row['userBp'].map(function (userBp) { return userBp.bpcName; }).join('<br>') : ''; }, width: '200px' },