SmartClient Version: v13.1p_2025-11-25/AllModules Development Only (built 2025-11-25)
Hi, I’m trying to use ViewFileItem with the #upload example.
After uploading a file successfully, and selecting the record in the grid, I would expect to see the preview and download icons in the viewForm, but they don’t show up.
Here is the code I’m using:
Is there an issue or am I missing something?
Hi, I’m trying to use ViewFileItem with the #upload example.
After uploading a file successfully, and selecting the record in the grid, I would expect to see the preview and download icons in the viewForm, but they don’t show up.
Here is the code I’m using:
Code:
<DataSource ID="mediaLibrary" serverType="sql" tableName="mediaLibrary">
<fields>
<field name="pk" type="sequence" hidden="true" primaryKey="true"/>
<field name="title"/>
<field name="image" type="binary" maxFileSize="5242880" required="true"/>
</fields>
</DataSource>
Code:
isc.DynamicForm.create({
autoDraw: false,
ID: "uploadForm", width: 300,
dataSource: mediaLibrary,
fields: [
{ name: "title", required: true },
{ name: "image", type: "imageFile", multiple:false, hint: "Maximum file size is 5 MiB" },
{ title: "Save", type: "button",
click: function () {
this.form.saveData("if(dsResponse.status>=0) uploadForm.editNewRecord()");
}
}
]
});
isc.DynamicForm.create({
autoDraw: false,
ID: "viewForm",
dataSource: mediaLibrary,
width: "100%",
fields: [
{ name: "title", title: "Title", type: "text", width: "*" },
{ name: "image", title: "image", editorType: "ViewFileItem", showFileInline:false,
startRow: false, endRow: false
}
]
});
isc.ListGrid.create({
autoDraw: false,
ID: "mediaListGrid",
width: "100%",
height: 224,
autoFetchData: true,
recordClick:"viewForm.editRecord(record)",
dataSource: mediaLibrary
});
isc.VLayout.create({
autoDraw: false,
ID:"mainLayout",
width:500,
height:250,
members:[viewForm, mediaListGrid]
});
isc.HStack.create({
width:"100%",
membersMargin: 10,
members:[uploadForm, mainLayout]
});
Comment