www.dextsolution.com
DEXTUPLOAD
X5
Reference > Events

## onDX5Created

- Version 1.0.0.0 or later

- Explanation

  The onDX5Created function is a callback function that is called when the component is created.

  Since DEXTUploadX5 can not determine the creation time with the DOM onload event, it calls the onDX5Created callback function when the component is created.

      function onDX5Created(id) {
          // Set something.
      }

- Uses

      # Declare event handlers globally
      function onDX5Created(id) { ... }

      # Register event handlers at component creation time (3.10.0.0 version or later)
      dx5.create({
          ...
          events: {
              created: function(id) { ... }
          }
      });

- Parameters

  Name | Type | Explanation
  --- | --- | ---
  id | String | The component id of the event

## onDX5Error

- Version 1.0.0.0 or later

- Explanation

  The onDX5Error function is a callback function that is called when an error occurs inside a component.

  HTTP will return an HTTP status code of 200 if the code completes successfully on the server when doing a GET, POST request (as does file upload). When DEXTUploadX5 receives the 200 code value from the server, it notices that the file upload is completed and calls the onDX5UploadCompleted callback function. On the other hand, if the server receives an HTTP status code, such as 400, 403, 404, or 500, it determines that an error has occurred and stops next operations and calls the onDX5Error callback function. Therefore, server-side code should not ignore an error, package it in a different format, and take action to ensure that 500 errors are delivered when an exception occurs. If the server catches an error like a try - catch statement and does not pass an error, the server will return a value of 200, so DEXTUploadX5 will determine that the upload was successful.

      function onDX5Error(id, code, message) {
          alert(code + "\n" + message);
      }

  If the onDX5Error function is not in the page, there is no way to check for errors that occurred. In addition to the onDX5Error function, DEXTUploadX5 has no logging facility to record errors separately.

- Uses

      # Declare event handlers globally
      function onDX5Error(id, code, message) { ... }

      # Register event handlers at component creation time (3.10.0.0 version or later)
      dx5.create({
          ...
          events: {
              error: function(id, code, message) { ... }
          }
      });

- Parameters

  Name | Type | Explanation
  --- | --- | ---
  id | String | The component id of the event
  code | String | Error code
  message | String | Error message

## onDX5ItemDoubleClick

- Version 1.0.0.0 or later

- Explanation

  The onDX5ItemDoubleClick function is a callback function that is called when an item is double-clicked with the mouse.

      function onDX5ItemDoubleClick(id, itemIndex, itemId, itemType) {
          ...
      }

- Uses

      # Declare event handlers globally
      function onDX5ItemDoubleClick(id, itemIndex, itemId, itemType) { ... }

      # Register event handlers at component creation time (3.10.0.0 version or later)
      dx5.create({
          ...
          events: {
              itemDoubleClick: function(id, itemIndex, itemId, itemType) { ... }
          }
      });

- Parameters

  Name | Type | Explanation
  --- | --- | ---
  id | String | The component id of the event
  itemIndex | Number | Order of the item
  itemId | String | Unique ID of the item
  itemType | String | Type of the item ("FILE", "FOLDER", "VIRTUAL")

## onDX5ItemSelect

- Version 1.0.0.0 or later

- Explanation

  The onDX5ItemSelect function is a callback function that is called when an item is selected.

  Selection events occur during a mouse click or keyboard movement process.

      function onDX5ItemSelect(id, itemIndex, itemId, itemType) {
          ...
      }

- Uses

      # Declare event handlers globally
      function onDX5ItemSelect(id, itemIndex, itemId, itemType) { ... }

      # Register event handlers at component creation time (3.10.0.0 version or later)
      dx5.create({
          ...
          events: {
              itemSelect: function(id, itemIndex, itemId, itemType) { ... }
          }
      });

- Parameters

  Name | Type | Explanation
  --- | --- | ---
  id | String | The component id of the event
  itemIndex | Number | Order of the item
  itemId | String | Unique ID of the item
  itemType | String | Type of the item ("FILE", "FOLDER", "VIRTUAL")

## onDX5ItemCheck

- Version 1.0.0.0 or later

- Explanation

  The onDX5ItemCheck function is a callback function that is called when an item is checked or unchecked.

      function onDX5ItemCheck(id, count) {
          ...
      }

- Uses

      # Declare event handlers globally
      function onDX5ItemCheck(id, count) { ... }

      # Register event handlers at component creation time (3.10.0.0 version or later)
      dx5.create({
          ...
          events: {
              itemCheck: function(id, count) { ... }
          }
      });

- Parameters

  Name | Type | Explanation
  --- | --- | ---
  id | String | The component ID where the event occurred
  count | Number | The number of items checked

## onDX5Preview

- Version 1.0.0.0 or later

- Explanation

  The onDX5Preview function is a callback function that is called when the preview is set to the event method.

      function onDX5Preview(id, itemIndex, itemId, itemSource) {
          target.src = itemSource;
      }

- Uses

      # Declare event handlers globally
      function onDX5Preview(id, itemIndex, itemId, itemSource) { ... }

      # Register event handlers at component creation time (3.10.0.0 version or later)
      dx5.create({
          ...
          events: {
              preview: function(id, itemIndex, itemId, itemSource) { ... }
          }
      });

- Parameters

  Name | Type | Explanation
  --- | --- | ---
  id | String | The component id of the event
  itemIndex | Number | Order of the item
  itemId | String | Unique ID of the item
  itemSource | String | Image source (data URL or local image path)

## onDX5ItemsToHDFinish(Support discontinued)

- Version 3.6.0.0 or later and earlier than 4.4.0.0

- Explanation

  The onDX5ItemsToHDFinish function is a callback function that is called when the addition of the list to be downloaded to the HD application is complete.

      function onDX5ItemsToHDFinish(id, arr) {
          console.log("Transferring items was finished");
      }

  The HD application already starts downloading files before the onDX5ItemsToHDFinish is called.

- Uses

      # Declare event handlers globally
      function onDX5ItemsToHDFinish(id, arr) { ... }

      # Register event handlers at component creation time (3.10.0.0 version or later)
      dx5.create({
          ...
          events: {
              itemsToHDFinish: function(id, arr) { ... }
          }
      });

- Parameters

  Name | Type | Explanation
  --- | --- | ---
  id | String | The component id of the event
  arr | Array | The array that contains files to be downloaded