Мой вопрос: как решить эту проблему и реализовать этот тип таблицы Полем Думая об использовании JS для построения таблиц и после сохранения все данные от объекта JS к контроллеру, но я думаю, что это также вызывает ошибку состояния просмотра. >
var attachmentList;
var maxStringSize = 6000000;
var j;
function uploadFiles(index){
var fileId = 'passportFile' + index;
input = document.getElementById(fileId);;
attachmentList = input.files;
if (j == undefined)
j = 0;
var file;
file = attachmentList[0];
var name = file.name;
var reader = new FileReader();
reader.onload = function (e) {
var attachmentbodybase64 = reader.result.replace(/^data:.+;base64,/, ''); //console log will print : ZGF0YTppbWFnZS9wbmc7YmFzZTY0LGlWQk9SdzB.....
console.log(attachmentbodybase64.length);
if (attachmentbodybase64.length > maxStringSize)
alert("File size is too large to handle");
else {
j++;
let path = 'page:form
let rowI = index-1;
$("[id$='"+path+rowI+":fileBody']").val(attachmentbodybase64).trigger('change');
$("[id$='"+path+rowI+":fileName']").val(name).trigger('change');
$("[id$='passportFile"+index+"label']").text(name);
}
}
reader.readAsDataURL(file);
}
- Directors
Full Name
Date of Birth
Copy of passport
{!IF(i.fileName == '','Select file',i.fileName)}
< /code>
и мой контроллер страницы: < /p>
global without sharing class TestPageController {
public List selectDirectorsList {get; set;}
public Integer rowIndex { get; set; }
public TestAssessmentController() {
rowIndex = 0;
selectDirectorsList = new list();
selectDirectorsList.add(new DirectorsWrapper(rowIndex,'','','','',null));
}
public void addDirector() {
rowIndex += 1;
selectDirectorsList.add(new DirectorsWrapper(rowIndex,'','','','',null));
}
public void deleteDirector() {
if(rowIndex != 0){
selectDirectorsList.remove(rowIndex);
rowIndex -= 1;
}
}
public void save(){}
public class DirectorsWrapper{
public Integer row { get; set; }
public String fullName { get; set; }
public String birthday { get; set; }
public Attachment passportAttach { get {if (passportAttach == null){ passportAttach = new Attachment(); } return passportAttach; } set; }
public String fileName { get; set; }
public transient blob fileBody { get; set; }
public DirectorsWrapper(Integer rowW,String fullNameW, String birthdayW, Attachment passportAttachW, String fileNameW, Blob fileBodyW){
this.row = rowW;
this.fullName = fullNameW;
this.birthday = birthdayW;
this.passportAttach = passportAttachW;
this.fileName = fileNameW;
this.fileBody = fileBodyW;
}
}
}
Подробнее здесь: https://stackoverflow.com/questions/794 ... input-file
Мобильная версия