2018-01-10 12:49:52 +00:00
|
|
|
# Lists
|
|
|
|
|
|
|
|
A list object handles object listing and paging, for a standard model.
|
|
|
|
|
|
|
|
### Example
|
|
|
|
|
|
|
|
```js
|
2018-01-16 06:09:17 +00:00
|
|
|
const Page = require('frappejs/frappe/client/view/page');
|
|
|
|
const List = require('frappejs/frappe/client/view/list');
|
2018-01-10 12:49:52 +00:00
|
|
|
|
|
|
|
// create a new page
|
|
|
|
let todo_list = new Page('ToDo List');
|
|
|
|
|
|
|
|
// init a new list
|
2018-01-16 06:09:17 +00:00
|
|
|
todo_list.list = new List({
|
2018-01-10 12:49:52 +00:00
|
|
|
doctype: 'ToDo',
|
|
|
|
parent: this.todo_list.body
|
|
|
|
});
|
|
|
|
|
|
|
|
todo_list.on('show', () => {
|
|
|
|
// refresh on show
|
|
|
|
todo_list.list.run();
|
|
|
|
})
|
|
|
|
```
|
|
|
|
|
|
|
|
## Creating a new List
|
|
|
|
|
|
|
|
You can create a new list object by passing the `DocType` and the parent element of the list
|
|
|
|
|
|
|
|
## Refreshing
|
|
|
|
|
|
|
|
To reload the list, call the `run` method
|