Please enable JavaScript.
Coggle requires JavaScript to display documents.
CLIENT-SIDE-DEV - Coggle Diagram
CLIENT-SIDE-DEV
API-DATA
DataTable({...})
ajax
url
/api/customers
dataSrc: ""
columns
[..]
data
name
membershipType.name
id
render
func
Arg
data
type
customer
Return
<a hrer='/customer/edit/
customer.id
\'> customer.name </a>
func(data)
<button class='btn-link js-delete'
data-customer-id=data
>Delete</button>
{data: "", [render: func] }
Remove
In-View
ForEach
If-Else
CustomerController
Returned-List
HIERARCHICAL
In-GetCustomers
EagerLoad
Customers.Include(..)
c => c.MembershipType
MembershipTypeDto
Fields
Id
Name
Add-In
CustomerDto
MappingProfile
Add
<MembershipType,
MembershipTypeDto>
DATATABLES
install-package
-version:1.10.11
jquery.datatables
In-BundleConfig.cs
Rename
jquery
To-lib
Append
From-Bootstrap
To-lib
Remove
BootstrapBundle
Add
In-lib
"~/Scripts/datatables/<>"
jquery.datatables.js
datatables.bootstrap.js
In-css
"~/Content/datatables/css/<>"
datatables.bootstrap.css
In-View
In-docReady
table =
$("#customers").DataTable();
CALL-API
DeleteBtn
In-View
table-id
customers
Add
Th-Delete
Td-Button
data-customer-id
@customer.Id
class
btn-link
js-delete
Script
$(doc).ready(func{..})
$("#customer").on(..)
"click"
"js-delete"
func()
button =
$(this)
bootbox.confirm("msg", func(result) {..})
if-result
$.ajax({..})
url
/api/customers/{id}
method: DELETE
success
table.row(...).remove().draw().
button.parents("tr")
BOOTBOX
install-package
bootbox
-version:4.3.0
In-BundleConfig.js
In-lib
Add
"~/Scripts/bootbox.js"