Async (AutoUpload Off): Attach metadata per file uploaded

2 posts, 1 answers
  1. Joe
    Joe avatar
    11 posts
    Member since:
    Jan 2014

    Posted 17 Jan 2014 Link to this post

    I have my upload set to be async with the autoupload off.  I have created a list template which adds a dropdown to each of the files to be uploaded.  How can I on upload reference the dropdown for each of the corresponding file uploads and pass that dropdown's value as metadata along with the file.  I know how to attach meta data, but I don't know how to get the current file's, that is being uploaded, container so I can get the correct dropdown value to attach to the metadata.  I have read that the files can upload out of order, so I can't depend on the files being uploaded in a perfect order.  

    Thanks,
    Joe
  2. Answer
    Dimiter Madjarov
    Admin
    Dimiter Madjarov avatar
    2153 posts

    Posted 21 Jan 2014 Link to this post

    Hi Joe,

    You could use the name parameter, that is passed to the template to identify the file, that is currently being uploaded and get it's list item. For example in the default template, the name is used as a title attribute of a span element. Here is a sample approach:
    function onUpload(e) {
        var name = e.files[0].name;
        var listItem = this.wrapper.find("[title='" + name + "']").closest("li.k-file");
        var ddlValue = listItem.find("[data-role='dropdownlist']").data("kendoDropDownList").value();
     
        e.data = {
            value: ddlValue
        }
    }

    I hope this information helps. Have a great day!

    Regards,
    Dimiter Madjarov
    Telerik
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  3. Kendo UI is VS 2017 Ready
Back to Top