ASP.NET CORE Passing Model As Data
ASP.NET CORE Passing Model As Data
MarkPerry
Posts: 1Questions: 1Answers: 0
Is it possible to do something like this when passing data to a datatable?
the @Model.KIT_REQUEST_ITEM is a List<Object>
$(document).ready(function () {
var table = $('#details').DataTable({
processing: true,
serverSide: false,
paging: false,
ordering: true,
searching: true,
info: false,
data: @Model.KIT_REQUEST_ITEM,
columns: [
{ data: "Name" },
{ data: "FBS_KITREQITEM_ORDEREDQUANTITY" }
]
});
});
Edited by Colin - Syntax highlighting. Details on how to highlight code using markdown can be found in this guide.
This discussion has been closed.
Answers
Not exactly like that since the Javascript engine won't run the .NET Core stuff. However, if you are able to transform your model into JSON then yes, you could use the
data
property to populate the table as shown here.Allan