-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I think name
should try to be parsed BEFORE data
. Here is why:
#41
Comments
I want to add that I know I can use all sorts of manual overrides of columnDefs.data and datatables.ejax (jQuery ajax). However, I do not like how my callers need to know about the EF entity! For example, this is currently a really dirty "fix" DataTables Optionsajax: {
url: editorRestURL,
type: "POST",
contentType: "application/json",
data: function (d) {
// Do not mutate d
var payload = $.extend({}, d);
for (var i = 0; i < payload.columns.length; i++) {
var column = payload.columns[i];
//...
// Handle when column is an object with an `entity` property
if (column.data && column.data.hasOwnProperty('entity')) {
column.data = column.data.entity;
}
}
return JSON.stringify(payload);
}
},
columnDefs: [
{
"targets": "InventoryServerInventoryServerWarrantyLines",
"data": {
"_": "InventoryServers",
"entity": "InventoryServerInventoryServerWarrantyLines"
},
"createdCell": function (td, cellData, rowData, row, col) {
$(td).html(rowData.InventoryServers
.map(function (server) {
return `${server.Name} (${server.SerialNumber})`;
})
.join(`,<br />`));
}
}
] I have to add my own Its been difficult to have the clients be aware of the EF entites for requests and then our domain objects (viewmodels) for responses. They should not hve to be aware of the entities. |
I think it's better to add some configuration property to public enum PropertyNameProcessingOrder
{
DataAndName, // this is default as now
NameAndData,
DataOnly,
NameOnly
} |
@AlexanderKrutov That is a great idea. |
https://github.com/AlexanderKrutov/DataTables.Queryable/blob/master/DataTables.Queryable/DataTablesRequest.cs#L173-L199
Because of the way DataTables.Queryable (DTQ) works with EF models directly, we usually AutoMapper back these results. This can lead to the return ViewModel being very different than the Entity.
Right now, jQuery DataTables uses columnDefs.data to try and traverse the actual data it gets back from the server. But name is different.
I want to be able to do:
Hopefully this is clear.
name
is used so when DTQ tries to traverse the actual properties to search and configure custom column searchs and all that and thendata
is used by jQuery DT to traverse the returned viewmodel.The text was updated successfully, but these errors were encountered: