Improve DataTable.Net AJAX Adapter (abp.libs.datatables.createAjax) function

pull/7590/head
Oliver Cooper 5 years ago
parent 7117d2f6fc
commit 9217fcf1ca

@ -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) {

Loading…
Cancel
Save