Skip to content
Advertisement

More sort column in JHipster

I try to configure sort column using the rout.ts file of my entity.

In the “data” tag I put defaultSort: ['firstCol,desc','secondCol,asc'], but I gave an error.

Then I put all in a single String defaultSort: 'firstCol,desc,secondCol,asc', but the secondCol is not considered the the query sent to microservice

Then I put all in a single String using a char separator like “;” 'firstCol,desc;secondCol,asc' but nothing! The secondCol is not considered.

I try to debug and see the ng-jhipster.js?064b file and see:

parsePredicate(sort) {
        return sort.split(',')[0].split('%2C')[0];
    }

It seems the only first parameter is passed (as I see effectively). Is there any other way to pass one other sort column (pass 2 columns in the same time).

I see Spring data rest accept more column simply append another sort column in the request: ?sort=name,asc&sort=numberOfHands,desc.

How can send this in jhipster???

Advertisement

Answer

Solved myself putting the sort column not in defaultSort of “data” tag, but specify the sort predicate in sort method if .component.ts

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement