accept
The value of this option is passed to the accept attribute of the underlying input element. Thus, the option accepts a MIME type or several types separated by a comma. Refer to the input element documentation for information on available values.
accessKey
The value of this option will be passed to the accesskey
attribute of the HTML element that underlies the widget.
allowCanceling
If this option is set to true, a cancel button is displayed for each selected file.
elementAttr
Specifies the attributes to be attached to the widget's root element.
You can configure this option in an ASP.NET MVC Control as follows:
@(Html.DevExtreme().WidgetName() .ElementAttr("class", "class-name") // ===== or ===== .ElementAttr(new { @id = "elementId", @class = "class-name" }) // ===== or ===== .ElementAttr(new Dictionary<string, object>() { { "id", "elementId" }, { "class", "class-name" } }) )
@(Html.DevExtreme().WidgetName() _ .ElementAttr("class", "class-name") ' ===== or ===== .ElementAttr(New With { .id = "elementId", .class = "class-name" }) ' ===== or ===== .ElementAttr(New Dictionary(Of String, Object) From { { "id", "elementId" }, { "class", "class-name" } }) )
height
This option accepts a value of one of the following types:
Number
The height in pixels.String
A CSS-accepted measurement of height. For example,"55px"
,"80%"
,"auto"
,"inherit"
.Function
A function returning either of the above. For example:JavaScriptheight: function() { return window.innerHeight / 1.5; }
isValid
In Knockout apps, you may need to inform a user about an error that occurred during the validation of a view model field. For this purpose, set the editor's isValid option to the isValid value of the dxValidator that validates this field. To show an error message, set the editor's validationError option to the dxValidator's validationError value.
var editorValue = ko.observable("").extend({ dxValidator: { validationRules: [{ type: 'required', message: 'Specify this value' }] } }); var viewModel = { editorOptions: { value: editorValue, isValid: editorValue.dxValidator.isValid, validationError: editorValue.dxValidator.validationError } };
The editor's isValid and validationError options should also be specified when using a custom validation engine. In this instance, the validation result will be displayed for the editor by the means of the DevExtreme Validation UI.
See Also
onContentReady
A handler for the contentReady event. Executed when the widget's content is ready. This handler may be executed multiple times during the widget's lifetime depending on the number of times its content changes.
Name | Type | Description |
---|---|---|
component |
The widget's instance. |
|
element |
The widget's container. It is an HTML Element or a jQuery Element when you use jQuery. |
|
model |
The model data. Available only when using Knockout. |
onDisposing
A handler for the disposing event. Executed when the widget is removed from the DOM using the remove(), empty(), or html() jQuery methods only.
Name | Type | Description |
---|---|---|
component |
The widget's instance. |
|
element |
The widget's container. It is an HTML Element or a jQuery Element when you use jQuery. |
|
model |
The model data. Available only if you use Knockout. |
onInitialized
Name | Type | Description |
---|---|---|
component |
The widget's instance. |
|
element |
The widget's container. It is an HTML Element or a jQuery Element when you use jQuery. |
You cannot access widget elements in this handler because it is executed before they are ready. Use the onContentReady handler instead.
onOptionChanged
Name | Type | Description |
---|---|---|
name |
The option's short name. |
|
model |
The model data. Available only if you use Knockout. |
|
element |
The widget's container. It is an HTML Element or a jQuery Element when you use jQuery. |
|
component |
The widget's instance. |
|
fullName |
The option's full name. |
|
value | any |
The option's new value. |
onProgress
A handler for the uploaded event.
Name | Type | Description |
---|---|---|
component |
The widget's instance. |
|
element |
The widget's container. It is an HTML Element or a jQuery Element when you use jQuery. |
|
model |
The model data. Available only if Knockout is used. |
|
file |
An uploaded file. |
|
segmentSize |
The size of the uploaded file segment. |
|
bytesLoaded |
The total count of the uploaded bytes. |
|
bytesTotal |
The total count of bytes in the XMLHttpRequest. |
|
jQueryEvent |
Use 'event' instead. The jQuery event that caused the handler execution. Deprecated in favor of the event field. |
|
event | Event (jQuery or EventObject) |
The event that caused the handler execution. It is a dxEvent or a jQuery.Event when you use jQuery. |
request |
An XMLHttpRequest for the file. |
onUploadAborted
A handler for the uploadAborted event.
Name | Type | Description |
---|---|---|
component |
The widget's instance. |
|
element |
The widget's container. It is an HTML Element or a jQuery Element when you use jQuery. |
|
model |
The model data. Available only if Knockout is used. |
|
file |
The uploaded file. |
|
jQueryEvent |
Use 'event' instead. The jQuery event that caused the handler execution. Deprecated in favor of the event field. |
|
event | Event (jQuery or EventObject) |
The event that caused the handler execution. It is a dxEvent or a jQuery.Event when you use jQuery. |
request |
Specifies an XMLHttpRequest for the file. |
onUploaded
A handler for the uploaded event.
Name | Type | Description |
---|---|---|
component |
The widget's instance. |
|
element |
The widget's container. It is an HTML Element or a jQuery Element when you use jQuery. |
|
model |
The model data. Available only if Knockout is used. |
|
file |
The uploaded file. |
|
jQueryEvent |
Use 'event' instead. The jQuery event that caused the handler execution. Deprecated in favor of the event field. |
|
event | Event (jQuery or EventObject) |
The event that caused the handler execution. It is a dxEvent or a jQuery.Event when you use jQuery. |
request |
Specifies an XMLHttpRequest for the file. |
onUploadError
A handler for the uploadError event.
Name | Type | Description |
---|---|---|
component |
The widget's instance. |
|
element |
The widget's container. It is an HTML Element or a jQuery Element when you use jQuery. |
|
model |
The model data. Available only if Knockout is used. |
|
file |
The uploaded file. |
|
jQueryEvent |
Use 'event' instead. The jQuery event that caused the handler execution. Deprecated in favor of the event field. |
|
event | Event (jQuery or EventObject) |
The event that caused the handler execution. It is a dxEvent or a jQuery.Event when you use jQuery. |
request |
Specifies an XMLHttpRequest for the file. |
Assign a function to perform a custom action when an error has occurred during uploading.
The following code shows how you can handle a network error.
jQuery
$(function(){ $("#fileUploader").dxFileUploader({ // ... onUploadError: function(e){ var xhttp = e.request; if (xhttp.readyState == 4 && xhttp.status == 0) { console.log("Connection refused."); } } }); });
Angular
export class AppComponent { handleNetworkError (e) { var xhttp = e.request; if (xhttp.readyState == 4 && xhttp.status == 0) { console.log("Connection refused."); } } }
<dx-file-uploader ... (onUploadError)="handleNetworkError($event)"> </dx-fileUploader>
onUploadStarted
A handler for the uploadStarted event.
Name | Type | Description |
---|---|---|
component |
The widget's instance. |
|
element |
The widget's container. It is an HTML Element or a jQuery Element when you use jQuery. |
|
model |
The model data. Available only if Knockout is used. |
|
file |
The uploaded file. |
|
jQueryEvent |
Use 'event' instead. The jQuery event that caused the handler execution. Deprecated in favor of the event field. |
|
event | Event (jQuery or EventObject) |
The event that caused the handler execution. It is a dxEvent or a jQuery.Event when you use jQuery. |
request |
Specifies an XMLHttpRequest for the file. |
onValueChanged
Name | Type | Description |
---|---|---|
component |
The widget's instance. |
|
element |
The widget's container. It is an HTML Element or a jQuery Element when you use jQuery. |
|
model |
The model data. Available only if Knockout is used. |
|
value |
Newly selected files. |
|
previousValue |
Previously selected files. |
|
jQueryEvent |
Use 'event' instead. The jQuery event that caused the handler execution. Deprecated in favor of the event field. |
|
event | Event (jQuery or EventObject) |
The event that caused the handler execution. It is a dxEvent or a jQuery.Event when you use jQuery. |
readyToUploadMessage
This option makes sense only if the uploadMode option is set to "useButtons".
rtlEnabled
When this option is set to true, the widget text flows from right to left, and the layout of elements is reversed. To switch the entire application/site to the right-to-left representation, assign true to the rtlEnabled field of the object passed to the DevExpress.config(config) method.
DevExpress.config({ rtlEnabled: true });
See Also
- Right-to-Left Support Demo: DataGrid | Navigation Widgets | Editors
tabIndex
The value of this option will be passed to the tabindex
attribute of the HTML element that underlies the widget.
uploadButtonText
The option makes sense only if the uploadMode option is set to "useButtons" or "instantly".
uploadedMessage
The option makes sense only if the uploadMode option is set to "useButtons" or "instantly".
uploadFailedMessage
The option makes sense only if the uploadMode option is set to "useButtons" or "instantly".
uploadMethod
The option makes sense only if the uploadMode option is set to "useButtons" or "instantly".
When using the widget as an ASP.NET MVC Control, specify this option using the UploadHttpMethod
enum. This enum accepts the following values: POST
and PUT
.
uploadMode
The option accepts the following values.
instantly
Starts uploading instantly as files are selected.useButtons
Starts uploading when a user clicks the "Upload" button.useForm
Uploads the specified files when the submit button of the current form is clicked. In this case, the FileUploader widget should be enclosed in the form element.
When using the widget as an ASP.NET MVC Control, specify this option using the FileUploadMode
enum. This enum accepts the following values: Instantly
, UseButtons
and UseForm
.
uploadUrl
The option makes sense only if the uploadMode option is set to "useButtons" or "instantly".
validationError
Specifies information on the validation error when using a custom validation engine. Should be changed at runtime along with the isValid option.
value
Specifies a File instance representing the selected file. Read-only when uploadMode is "useForm".
width
This option accepts a value of one of the following types:
Number
The width in pixels.String
A CSS-accepted measurement of width. For example,"55px"
,"80%"
,"auto"
,"inherit"
.Function
A function returning either of the above. For example:JavaScriptwidth: function() { return window.innerWidth / 1.5; }
If you have technical questions, please create a support ticket in the DevExpress Support Center.