erictgrubaugh
02/10/2019, 6:43 PMEric B
02/10/2019, 7:36 PMerictgrubaugh
02/10/2019, 8:00 PMerictgrubaugh
02/10/2019, 8:06 PMfieldChanged
, so I don't have access to the serverWidget
module, nor can I run anything on ready()
because the buttons don't exist yet =/ Still an interesting idea using the require()
to pull it in at runtime. Trying to work with that a bit moreerictgrubaugh
02/10/2019, 8:10 PM<button type="button" onclick="require(['SuiteScripts/supported-artist-update/sd_SA_CL.js'], function(mod){mod.supportApplicant();})" data-id="128">Support</button>
erictgrubaugh
02/10/2019, 8:11 PMsupportApplicant
erictgrubaugh
02/10/2019, 8:20 PMrequire
-ing the module that way loads supportApplicant()
just fineerictgrubaugh
02/10/2019, 8:21 PMdefine
-ing it doesn'terictgrubaugh
02/10/2019, 8:21 PMform.clientScriptModulePath
works when attaching the scriptEric B
02/10/2019, 8:21 PMerictgrubaugh
02/10/2019, 8:22 PMfunny
but it's actually very annoying
erictgrubaugh
02/10/2019, 8:22 PMsubmitFields()
Eric B
02/10/2019, 8:25 PMerictgrubaugh
02/10/2019, 8:28 PMerictgrubaugh
02/10/2019, 8:29 PMerictgrubaugh
02/10/2019, 8:29 PMdata-id
property so I know which internal ID to updateEric B
02/10/2019, 8:29 PMerictgrubaugh
02/10/2019, 8:30 PMerictgrubaugh
02/10/2019, 8:31 PMonclick
string; i.e. onclick='var id = /* how would I read it from here? */; require(..., mod.supportApplicant(id); ...);
erictgrubaugh
02/10/2019, 8:31 PMthis
within onclick
is bound to window
erictgrubaugh
02/10/2019, 8:32 PMerictgrubaugh
02/10/2019, 8:32 PMerictgrubaugh
02/10/2019, 8:33 PMclientScriptModulePath
just exported all of its output correctly 😄Eric B
02/10/2019, 8:36 PMerictgrubaugh
02/10/2019, 8:40 PMerictgrubaugh
02/10/2019, 8:44 PMfunction toTableRow(html, applicant) {
// XXX Crappy workaround for click handler export not functioning correctly
var onclick = "require([\"" + CLIENT_PATH + "\"], function(mod){mod.supportApplicant(" + applicant.id + ");})";
return html + [
"<tr><td>",
applicant.individualName, " (", applicant.role, ")",
"</td><td>",
"<button type='button' onclick='" + onclick + "'>Support</button>",
"</td></tr>"
].join("");
}
erictgrubaugh
02/10/2019, 8:48 PMerictgrubaugh
02/10/2019, 8:54 PMmwalker
02/10/2019, 9:09 PMerictgrubaugh
02/10/2019, 11:02 PMjoin()
and reduce()
definitely my preference over +=
🙂