Reputation: 733
I've created a grid with a custom popup edit window. In the template I'm using data attributes to give values to the appropriate inputs. For example:
<input id="cgrid-edit-contact" name="contact" tabindex="3" data-bind="value: contact.contactid" style="width:214px" />`
The problem I'm having is I have a KendoUpload widget where I want to show the file that has been previously uploaded. The following page says that to configure widgets you provide data-
followed by the Kendo attribute name. So to set the files attribute would look like this:
<input id="cgrid-edit-file" type="file" data-files="[{name: 'file1.doc', size: 525, extension: '.doc'}]" style="width:214px;display:inline" />
Obviously the content should be dynamic, but I cannot even get static values to initialize. Has anyone run into this before?
Upvotes: 1
Views: 2689
Reputation: 21
In the meantime MVVM is supported:
HTML:
<!-- .. -->
data-files="[ viewModel.GetCurrentFilename() ]"
<!-- .. -->
JS:
//.. viewModel ..
GetCurrentFilename: function ()
{
return {name: 'file1.doc', size: 525, extension: '.doc'};
}
//..
Upvotes: 2
Reputation: 30671
The following should work:
<input id="cgrid-edit-file"
type="file"
data-files="[{name: 'file1.doc', size: 525, extension: '.doc'}]"
data-role="upload"
data-async="{ saveUrl: 'save' }"
/>
However you currently cannot use MVVM to specify the files which the upload can display. You can only specify them as a data attribute.
Upvotes: 1