diff options
Diffstat (limited to 'kvision-modules/kvision-select/src/main')
-rw-r--r-- | kvision-modules/kvision-select/src/main/kotlin/pl/treksoft/kvision/form/select/AjaxOptions.kt | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/kvision-modules/kvision-select/src/main/kotlin/pl/treksoft/kvision/form/select/AjaxOptions.kt b/kvision-modules/kvision-select/src/main/kotlin/pl/treksoft/kvision/form/select/AjaxOptions.kt index 212dc456..fb1ad2fd 100644 --- a/kvision-modules/kvision-select/src/main/kotlin/pl/treksoft/kvision/form/select/AjaxOptions.kt +++ b/kvision-modules/kvision-select/src/main/kotlin/pl/treksoft/kvision/form/select/AjaxOptions.kt @@ -77,12 +77,19 @@ enum class DataType(internal val type: String) { * option */ data class AjaxOptions( - val url: String, val preprocessData: (dynamic) -> dynamic, val beforeSend: ((JQueryXHR) -> dynamic)? = null, - val data: dynamic = null, val httpType: HttpType = HttpType.GET, - val dataType: DataType = DataType.JSON, val minLength: Int = 0, - val cache: Boolean = true, val clearOnEmpty: Boolean = true, val clearOnError: Boolean = true, + val url: String, + val preprocessData: (dynamic) -> dynamic, + val beforeSend: ((JQueryXHR, dynamic) -> dynamic)? = null, + val data: dynamic = null, + val httpType: HttpType = HttpType.GET, + val dataType: DataType = DataType.JSON, + val minLength: Int = 0, + val cache: Boolean = true, + val clearOnEmpty: Boolean = true, + val clearOnError: Boolean = true, val emptyRequest: Boolean = false, - val requestDelay: Int = AJAX_REQUEST_DELAY, val restoreOnError: Boolean = false + val requestDelay: Int = AJAX_REQUEST_DELAY, + val restoreOnError: Boolean = false ) /** @@ -109,10 +116,11 @@ fun AjaxOptions.toJs(emptyOption: Boolean): dynamic { return obj { this.ajax = obj { this.url = url - this.type = httpType.type + this.method = httpType.type this.dataType = dataType.type this.data = data this.beforeSend = beforeSend + this.contentType = "application/json" } this.preprocessData = procData this.minLength = minLength @@ -124,5 +132,6 @@ fun AjaxOptions.toJs(emptyOption: Boolean): dynamic { this.requestDelay = requestDelay this.restoreOnError = restoreOnError this.langCode = language + this.processData = false } } |