Browse Source
Merge pull request #7590 from olicooper/pr/datatable-createajax
Improve DataTable.Net AJAX Adapter
pull/7673/head
Halil İbrahim Kalkan
5 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with
13 additions and
2 deletions
docs/en/UI/AspNetCore/Data-Tables.md
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/wwwroot/libs/abp/aspnetcore-mvc-ui-theme-shared/datatables/datatables-extensions.js
@ -110,7 +110,7 @@ The `createAjax` also supports you to customize request parameters and handle th
**Example:**
````csharp
var inputAction = function () {
var inputAction = function (requestData, dataTableSettings ) {
return {
id: $('#Id').val(),
name: $('#Name').val(),
@ -131,6 +131,14 @@ var responseCallback = function(result) {
ajax: abp.libs.datatables.createAjax(acme.bookStore.books.book.getList, inputAction, responseCallback)
````
If you don't need access or modify the `requestData` or the `dataTableSettings` , you can specify a **simple object** as the second parameter.
**Note:** This option should not be used if you need to customise any of the following options: `maxResultCount` , `skipCount` , `sorting` , `filter` - these options will be overwritten by the `createAjax` function so you should specify an `inputAction` **function** instead.
````javascript
ajax: abp.libs.datatables.createAjax(acme.bookStore.books.book.getList, { id: $('#Id').val(), name: $('#Name').val() })
````
### Row Actions
`rowAction` is an option defined by the ABP Framework to the column definitions to show a drop down button to take actions for a row in the table.
@ -334,7 +334,10 @@
} ;
}
return function ( requestData , callback , settings ) {
var input = inputAction ? inputAction ( requestData , settings ) : { } ;
var input = typeof inputAction === 'function'
? inputAction ( requestData , settings )
: typeof inputAction === 'object'
? inputAction : { } ;
//Paging
if ( settings . oInit . paging ) {