Jqgrid:如何在编辑对话框中获取 Unformat 单元格值 window

Jqgird: how to Get the Unformat cell value in edit dialog window

我在 Jqgrid 中使用 Handler 完成了 FileUpload。当我单击 "ADD" 时,我可以浏览文件并上传值。

但是现在如果我想编辑相同的路径,当我点击 "EDIT" 时它不会带来已经浏览过的文件。

下面是colmodel:

{
    
   name: 'FormPath', index: 'FormPath', editable: true, width: 50, edittype: 'file',                                          
   editoptions: 
   {  
      enctype: "multipart/form-data"
   },
   formatter: function (cellvalue, options, rowObject)
   {
      return '<a href="' + cellvalue + '">' + rowObject.FormDisplayName + '</a>';
   },
   unformat: function (cellvalue, options, cell)
   {
       return $('a', cell).attr('href');
   }
}

下面是我在 Form_edit 对话框中调用的 beforeshowForm 事件。其他控件正在绑定正确的数据。但是这个 FormPath 不是。

beforeShowForm: function (form) 
{
    $("#FormError").remove();
    $("#tr_FormDisplayName", form).show();
    $("#tr_FormPath", form).show();
    $('#tr_FormDesc', form).show();
    $('#tr_SecurityTag', form).show();
}

任何人都知道如何将未格式化的值填充到 jqgrid 编辑对话框中的单元格中。

提前致谢。

在我看来,您想填写

的输入值
<input type="file" ... />

但出于安全原因(据我所知)这是不可能的。例如,参见 the answer

顺便说一句,jqGrid 没有任何内置的文件上传支持。所以你必须使用一些额外的插件(比如Plupload)或者编写相对较长的代码。无论如何,您将无法 "pre-fill" <input type="file"/> 输入数据。