Comments (3)
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 Options
ajax: {
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 entity
property to columnDefs.data
so I can make sure the ajax call submits a property the server understands (because DTQ makes me configure searches against entity properties only) and for everything else I use the built in "_"
so jQuery DT can use the property on the JSON (the ViewModel)
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.
from datatables.queryable.
I think it's better to add some configuration property to DataTablesRequest
which will indicate processing order for the data
and name
parameters.
Something like this:
public enum PropertyNameProcessingOrder
{
DataAndName, // this is default as now
NameAndData,
DataOnly,
NameOnly
}
from datatables.queryable.
@AlexanderKrutov That is a great idea.
from datatables.queryable.
Related Issues (20)
- In the sample, if I type "Mar" it finds start dates but "March" does not. Why is this? HOT 1
- Better error handling when the request tries to reflect to the desired type.
- Ordering on a complex type does not work. HOT 3
- .net core 2.0 JsonDataTable ? HOT 3
- Using the library with in-memory objects HOT 5
- Support passing up CancellationTokens to ToPagedListAsync(). HOT 4
- AutoMapper ProjectTo() blows up. HOT 4
- ToNameValueCollection() throws when a column is provided but a search is not. HOT 2
- Multi column ordering does not work? HOT 2
- NullReferenceException inside GetPropertyByName HOT 2
- Support for Multiple Filter Values on Same Column HOT 2
- NullReferenceException inside BuildStringContainsPredicate HOT 6
- I really need to know what name/data failed when calling GetPropertyByName. HOT 1
- Add custom Data Fields to DataTablesAjaxPostModel HOT 2
- How to add (Edit &Delete) buttons in datatable? HOT 1
- Can we use/call SQL store procedure? HOT 1
- How to use with Razor Pages HOT 2
- ToPagedListAsync Call is ambiguous HOT 1
- Allow ToPagedListAsync to take cancellation token
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from datatables.queryable.