1

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?

Mohsen
  • 4,536
  • 2
  • 27
  • 49
curlie
  • 275
  • 2
  • 6
  • 17
  • I don't get your point, in JDL you can enable pagination per entity http://www.jhipster.tech/jdl/ – Gaël Marziou Oct 27 '17 at 21:20
  • Ok yes you are right. So you suggest I import the jdl file again into my project ? Can I only include this one entity (this time with Pagination) in the jdl file to make this change happen? – curlie Oct 28 '17 at 09:34

3 Answers3

1

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.

Jon Ruddell
  • 6,244
  • 1
  • 22
  • 40
  • Hi Jon, one reason I tend to use entity generator through questions over JDL is that I don't know how to make incremental changes like here only one one entity in JDL without regenerating all entities. Our doc does not cover this unless I'm wrong. – Gaël Marziou Oct 28 '17 at 09:47
  • This behavior changed recently. It used to be that on import of JDL, all entities would regenerate. Now, only entities that have changes are regenerated. Commit: https://github.com/jhipster/generator-jhipster/commit/f3b731fcb3ddee74b54375b3c552c7849693c02d – Jon Ruddell Oct 28 '17 at 20:00
1

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.

Vaibhav
  • 136
  • 1
  • 3
  • 13
0

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

Lucke
  • 316
  • 6
  • 18