Google 앱 중 하나에서 비슷한 작업을 수행합니다. 클릭 할 때 'mailto'를 호출하고받는 사람, 제목 및 본문으로 전자 메일 클라이언트를 채우는 단추를 화면에 추가했습니다. 본문은 스크립트의 일부로 생성됩니다. 기본적으로 테이블 내용을 배열로 읽어 들인 다음 forEach를 사용하여 항목을 반복합니다. mailto 또는 심지어 URLHelper를 사용하여 이메일의 '본문'에 HTML 형식의 텍스트를 사용하는 것을 허용하지 않습니다. 따라서, 당신이 무언가를 예쁜 찾고있는 경우에, 당신은 운이 좋지 않을지도 모른다.
onNotifyUserPress: function(oEvent) {
var oItem = oEvent.getSource();
var oBinding = oItem.getBindingContext();
// Set some vars for the email package
var sEmpEmail = oBinding.getProperty("Smtp");
var sEmpName = oBinding.getProperty("STEXT_2");
var sEmailSubject = "Your Subject " + sEmpName;
// Create DateFormat Object
var oDateFormat = DateFormat.getDateTimeInstance({pattern: "dd/MM/yyyy"});
// Retrieve Table Data
var oTable = this.getView().byId("yourTable");
var aTableData = oTable.getBinding("items").getContexts();
// Build the email body
var sBody = sEmpName + " - Some Body Text\n\n";
sBody += "Field 1 | " + "Field 2 | " + "Field 3 | " + "Field 4" + "\n";
// Loop through table data and build the output for the rest of the email body
aTableData.forEach(function(oModel) {
var oModelData = oModel.getObject();
var sEndDate = oDateFormat.format(oModelData.Vendd);
var sStatus = this._formatStatus(oModelData.ZQ_STAT);
sBody += (oModelData.Essential === "X" ? "Yes" : "No") + " | " + oModelData.Ttext + " | " + sEndDate + " | " + sStatus + "\n";
}.bind(this));
// Open email client window and prepopulate with info
window.open("mailto:" + sEmpEmail + "&subject=" + sEmailSubject + "&body=" + encodeURIComponent(sBody), "_self");
},
분명히 테이블 데이터를 가리 키도록 코드를 업데이트해야합니다. 이 특별한 경우에는 몇 개의 섹션이있는 객체 페이지가 있습니다. 각 섹션에는 사용자와 연결된 엔터티 목록을로드하는 테이블이 있습니다. 데이터가 이미로드되어 모델에 존재하므로 데이터를 입력하거나 수정 한 후 이메일을 보내야하므로 (올바르게 이해 한 경우) 수행하려는 것과 동일한 방식으로 작동하지 않을 수 있습니다.
적어도이 기능을 시작하시기 바랍니다.
건배!