darrachequesne / spring-data-jpa-datatables

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

How to search on a rendered column? #100

Closed sebasira closed 4 years ago

sebasira commented 5 years ago

I have a column that renders joining two values like this:

data: 'name', // I need to put something here. If I put NULL I get NPE render:function (data, type, row) { var fullName =row.name + "," + row.lastName; return fullName; },

So basically I have Name and LastName in a single column. The problem is that the search (the global one and also adding search for each column at the bottom) is not working. No matter what I type it never finds anything in that column.

All other columns that are not rendered works perfectly fine.

How can I solve it? I know I can easily solve it using one column for name an another one for lastname but I would like to avoid that.

Thank you!

sebasira commented 5 years ago

Sorry, my bad... It was another silly mistake. It works fine but in only search on the column I put as data, in my example above that would be the name.

Is there any way to instruct to search in both columns?

syfercv commented 4 years ago

Did anyone found any solution for this? I have similiar issue, but in my case it makes the search to crash.

'data': 'allotment',
'render': function(data, type, row, meta) {
        return "[" + data.parent.name + "] " + data.name;
}

org.springframework.transaction.UnexpectedRollbackException: Transaction silently rolled back because it has been marked as rollback-only

darrachequesne commented 4 years ago

Please take a look at https://github.com/darrachequesne/spring-data-jpa-datatables#search-on-a-rendered-column