Simple CRUD Tutorial
In this tutorial, we are going to build an employee management system. This section will cover things needed to perform a CRUD operation along with listing and searching.
CRUD
Login to
admin panel
[
http://localhost:4200/admin/login] with following credentials:
Since we are building an employee management CRUD, we need some designations to assign for each employee. So let's create a set of designations first.
Magpie provides section management to generate a CRUD operation.
Click on
In the form fill out all the fields. The fields are explained below:
Following is the JSON config used to generate designation CRUD
Here the designation collection has two fields.One is
designation name
and other one is a
designation code
. We are going to use textboxes for entering the values. In the config
column
array will specify the fields needed and the datatype needed.
For example,
"field": "designation_name"
means that designation name will be stored in the collection with
field
as
designation_name
. Beyond that, any other included file provides support for packages, license information, and development.
Likewise,
"type": "textbox"
means that the
field type
in the form will be
textbox
"label": "Designation"
means that the
label
to be displayed in the form against the textbox will be
Designation
"class": "textbox"
will assign the css class
textbox
for the text field
"sortable": "true"
makes the column
sortable
in the listing
"searchable": "true"
makes the column
searchable
in the listing
"list": "true"
will add a
listing
page to display contents
"view": "true"
makes the column visible in the
detail view
of the record
"placeholder": "Enter the designation code"
The placeholder attribute specifies
a short hint
that describes the expected value of an input field
"validation_msg": {"required": "designation name is required"}
lets you add validations message to the field.
"export":"false"
makes the column not exporting in the listing
"validations": [{
"required": "true"
}]
lets you add validations to the field. For the this tutorial am just adding
required
validation only
"pagination": "true"
triggers the
pagination
in the listing
"per_pagecount": "10"
will assign the
number of records
to be displayed in a single page of the listing to
10
"import_unique_field": "designation_name"
set a unique field for importing
Now that the section is configured, let's see how we can add this to side menu on Setting up a menu