curlie
curlie

Reputation: 295

JHipster how to change the view from an entity to Pageable

I am looking for the easiest way for including Pagination for one of the entities I have created with the help of JDL Studio which JHipster provides. I have not chosen the Pagination option in the jdl file as I do not need Pagination in general, only for one entity. How can I make this change manually?

Upvotes: 1

Views: 2242

Answers (3)

Lucke
Lucke

Reputation: 316

1- go to:

/{projectRoot}/.jhipster/YourEntity.json

2- Find And set pagination property like this:

From

"pagination": "no",

To

"pagination": "pagination",

3- open a prompt and type:

jhipster entity [entityName]

This ask you to reload your entity you can choose "regerate" or "update" (and more options) for your entity.

This should implement all pagination system.

Tested in Jhipster 6.8.0

Upvotes: 0

Vaibhav
Vaibhav

Reputation: 146

Following are the steps to add pagination to the existing entity which does not have existing pagination.

  1. Change "pagination" option
    You can do this by changing by "pagination": "no" to "pagination": true from EntityName.json file from ./ProjectName/.jhipster directory.
  2. Update JDL file xxx.jh
entity Company{
    name String
}

entity Employee{
    empName String
}

paginate Employee with pagination

I want pagination for Employees only so I have updated paginate Employee with pagination
3. Import entities by using,
jhipster import-jdl xxx.jh

After successful import, the impact will be on both the server and client side.
On the server side mainly EntityNameResource.java and EntityNameService.java will change.
On the client side EntityName.component.html, multiple supporting.ts files will change.

Upvotes: 1

Jon Ruddell
Jon Ruddell

Reputation: 6352

The below JDL shows how you can specify pagination for one entity. Entity A will be the only entity with pagination

entity A {
    name String required
}

entity B {}

entity C {}

paginate A with pagination

For more information on declaring options in JDL, see the official docs.

Upvotes: 1

Related Questions