By the 1 Minute Quick Start, We get a default listing page with default columns, But default columns from database columns rarely fit the needs for any real application. Here we will introduce common customizations on the list page.
- Configure fields that displayed on the page
- Modify the display value
- Display a virtual field
- Default scope
- Extend the dot menu
There would be a runable example at the last.
Configure fields that displayed on the page
Suppose we added a new model called
Post belongs to
Category. Then we want to display
CategoryID on the list page.
Modify the display value
To display the category name rather than category id in the post listing page. The
ComponentFunc would do the work.
obj is the
Post record, and
field is the
CategoryID field of this
Post record. You can get the value by
Display virtual fields
If we want to display
disabled=false only. Use the
Listing().Searcher to apply SQL conditions.
Extend the dot menu
You can extend the dot menu by calling the
RowMenuItem function. If you want to overwrite the default
Delete link, you can pass the items you wanted to