diff options
author | Robert Jaros <rjaros@finn.pl> | 2018-12-19 12:14:03 +0100 |
---|---|---|
committer | Robert Jaros <rjaros@finn.pl> | 2018-12-19 12:14:03 +0100 |
commit | 474195d3aa862686712cfe6c800dc43f8fee8ec5 (patch) | |
tree | 2c89307d8740b3efa7648061dbeb57a822c40e6d /kvision-modules/kvision-select/src/main/kotlin/pl/treksoft | |
parent | 161264957dc1b41cd6716ee7777139c5e29589f5 (diff) | |
download | kvision-474195d3aa862686712cfe6c800dc43f8fee8ec5.tar.gz kvision-474195d3aa862686712cfe6c800dc43f8fee8ec5.tar.bz2 kvision-474195d3aa862686712cfe6c800dc43f8fee8ec5.zip |
An addon remote module for select component.
Diffstat (limited to 'kvision-modules/kvision-select/src/main/kotlin/pl/treksoft')
-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 } } |