Hi,
I have my kendo upload widget (via angular) defined as:
<
input
name
=
"files"
<br> id="files"<
br
> type="file"<
br
> kendo-upload="uploader"<
br
> k-options="uploadOptions"<
br
> k-template="kendoTemplate()"<
br
> k-rebind="initialFiles"/>
I display all the files using initial files option. My objective is to continue to display the list of all files I get from server; once a given file is uploaded.
Because I have the rebind set on $scope.initialFiles; in onSuccess (I also tried onComplete)
I do:
<p>
function
onSuccess(e) {</p><p> $scope.initialFiles.length = 0;<br> populate();<br>}</p>
where the populate function uses $http service to get data and re-populate $scope.initialFiles...
This works fine with "drag and drop" functionality...but when I upload using the "Select..." button (I've renamed it to "Browse Files").. I get the error:
"Cannot read property 'get' of undefined"
It happens in kendo.min.js (appreciate this is minified code but pasting to give the context). I have marked the line that throws the error.
<p>
function
g(t, n, i, r, o, a, s) {<br>
var
l = n.$watch(o,
function
(o, c) {<br>
var
d, u, h, f;<br> t._muteRebind || o === c || (l(),<br> d = B[t.options.name],<br> d && d.forEach(
function
(t) {<br>
var
i = n.$eval(s[
"k"
+ t]);<br> i && r.append(e(i).attr(kendo.toHyphens(
"k"
+ t),
""
))<br> }),<br> u = e(t.wrapper)[0],<br> h = e(t.element)[0],<br> f = i.injector().get(
"$compile"
),
//**** this line throws the error<br> t._destroy(),</p><p></p>
I need to rebind the widget because after the upload; if I do not do $scope.initialFiles.length = 0;I do not get the current status of files. For example: if the user uploaded text.txt and then in order to overwrite the existing test.txt; reuploaded the same file - although its overwritten on the server - the UI continues to show two instances of text.txt.
How can I best; re-create the upload widget after the upload finishes (note I get the same error with onSuccess and onComplete) so that the list of files shown is only what's in $scope.initialFiles and fix the error I am getting now. The impact of error is that the widget does not get recreated...
Thanks a lot,
Labhesh