Listing
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 Category
, the 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.
The obj
is the Post
record, and field
is the CategoryID
field of this Post
record. You can get the value by field.Value(obj)
function.
Display virtual fields
DefaultScope
If we want to display Post
with 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 Edit
and Delete
link, you can pass the items you wanted to Listing().RowMenu()