In grid examples, columntypes demo we would like to have widget type as filepicker?
{
text : 'Widget',
field : 'age',
width : 100,
type : 'widget',
widgets : [{
type : 'filepicker',
}]
}
Do we have to configure FilePicker seperately ?
Could you please give some example?
Re: widget column types as filepicker
Posted: Wed Sep 11, 2019 1:41 pm
by sergey.maltsev
Hi, janan!
Try this config for filepicker column
{
text : 'Filepicker',
field : 'name',
width : 100,
type : 'widget',
widgets : [
{
type : 'text'
},
{
type : 'filepicker',
valueProperty : 'value',
onChange : ({ source }) => {
// Assign first file name to record's "name" property
source.cellInfo.record.name = source.files[0].name;
// If you want to hide a badge
source.button.badge = '';
}
}]
},
Don't forget to import FilePicker.js
import '../../lib/Common/widget/FilePicker.js';
Re: widget column types as filepicker
Posted: Wed Oct 02, 2019 4:03 pm
by janan
Hi,
I am using file picker in one of the columns . When i get storechanges as below i do not get file uploaded row in store changes.
var storeChanges = br.store.changes
Can you please help ?
Re: widget column types as filepicker
Posted: Thu Oct 03, 2019 9:07 am
by sergey.maltsev
Hi!
This is sample code.
new Grid({
appendTo : 'container',
columns : [
{
text : 'File',
field : 'file',
width : 100,
type : 'widget',
widgets : [
{
type : 'text'
},
{
type : 'filepicker',
valueProperty : 'value',
onChange : ({ source }) => {
// Assign first file name to record's "file" property
source.cellInfo.record.file = source.files[0].name;
// If you want to hide a badge
source.button.badge = '';
}
}]
}
],
store : new Store({
data : [{ file : 'empty' }],
listeners : {
change : ({ changes }) => {
console.log('changes', JSON.stringify(changes));
}
}
})
});
You will see something like this in console after selecting a file
hi,
This above works in getting the file name .But how do i send the file object ?If i send the data JSON.stringify i do not get the file object with it.
Hi,
We use 'filePicker' widget based on the above example. After updating based on latest release, onChange function is running twice. Could you help it ?