Explanation
To use the DEXTUploadX5 component, you must include the dextuploadx5-configuration.js file and the dextuploadx5.js file.
<script src="../dx5/dextuploadx5-configuration.js"></script> <script src="../dx5/dextuploadx5.js"></script>
When the browser reads the dextuploadx5.js script file, a dx5 object that manages DEXTUploadX5 is automatically created.
To create a component, you need a container element that contains a component, and at the end of the page you can create the component using the dx5.create function.
The size of a component is based on the size of the container that holds the component. Therefore, you must specify the size of the container.
<div id="dext5-container" style="width:500px; height:300px;"><!-- container element that holds a component --></div>
<script>
dx5.create({
// Give the component a DOM ID with the id attribute.
// parentId specifies the container ID
id: "dext5", parentId: "dext5-container",
// The component does not have any buttons, so you have to create the button elements.
// If you create a button element(input [type = button]) and specify the target ID to btnFile property, the file add function is automatically linked.
btnFile: "btn-add-files"
});
</script>
If "DEXTUploadX5 component loading failed!" message pops up, there is a problem with setting the productPath property in dextuploadx5-configuration.js, so make sure the path is correct.
If DEXTUploadX5 was created correctly, it calls the onDX5Created callback function. If an error occurs during use, it is set to call onDX5Error function.
function onDX5Error(id, code, msg) {
// Invoked when an error occurs while using the component.
}
function onDX5Created(id) {
// Invoked when the component is created.
}
Example