Hi, I'm trying to add button here using User Event...
# suitescript
g
Hi, I'm trying to add button here using User Event Script, but find it difficult. That dropdown menu is not populating when the beforeload function is called, but is populating when the mouseover event is occured for the first time. How to add button in beforeload?
b
print is not suppported, you can add an option to the more actions
or you can add a button
else you need to do dom manipulation
g
I found it difficult to do dom manipulation
As I mentioned above, that dropdown menu is not existing till mouseover event is triggered
so I can't do dom manipulation in User Event script beforeload entry point
b
correct, beforeload is too early, its serverside, before the dom is even served to be rendered
Client Script is the one for dom manipulation
g
This is view page, can I use client script?
anyway that's beside the point
b
you can use Form.clientScriptModulePath, though you wont have access to the client script entry points
1
g
The main point is that that dropdown div is not existing
till I move mouse over the print icon
that means I can only append the button div after I move mouse over it.
I tried to get mouse over event and then append at that time, but I can't get event either
b
as in you couldnt add your own mouseover event
or you couldnt modify the existing one
g
I can't modify existing one
b
what did your attempt look like
g
jQueryObj = form.addField({ id: 'custpage_jquery', type: serverWidget.FieldType.INLINEHTML, label: ' ' });
b
that by itself doesnt do anything interesting
g
let script = '<script type="text/javascript">\n' + 'let printDiv = jQuery("#spn_PRINT_d1")\n' + 'printDiv.on("mouseover", function(){\n' + 'jQuery("#div_PRINT_d1 .ac_table tbody").append("<tr>....</tr>");\n' + '});\n' + '</script>';
jQueryObj.defaultValue = script;
this is it
b
thats an attempt to add your own mouseover event
1
what you have looks reasonable, except the ...
although the event probably doesnt do what you want
its adding the tr at the wrong time and probably in a manner that created duplicates
take a look at the event listener that netsuite uses to see the timing issue involving setTimeout