Due to the security, the browser doesn't allow to change the File's value. When the File is created, its value will be reset. If you want to display the chosen file name when editing a row, you should store the file name and reset the text of filebox component when editing it. Please refer to the code below:
$('#dg').datagrid({
columns: [[
{field:'itemid',title:'Item ID',width:200,editor:'textbox'},
{field:'productid',title:'Product',width:200,
formatter: function(value,row){
return row.fileName || value;
},
editor: {
type: 'filebox',
options: {
buttonText: '...'
}
}
}
]],
onBeginEdit: function(index,row){
var ed = $(this).datagrid('getEditor',{index:index,field:'productid'});
row.fileName = row.fileName || row.productid;
$(ed.target).filebox('setText',row.fileName)
},
onEndEdit: function(index,row){
var ed = $(this).datagrid('getEditor',{index:index,field:'productid'});
var files = $(ed.target).filebox('files');
if (files.length){
row.fileName = files[0].name;
}
}
})