Invoking file upload event by button

Since I absolutely needed this I had to inject JS. use this post as a reference

The code to invoke, file upload from a button would be.

code = """<img style='display:none' src='/favicon.ico' onload="
    const eventButton = document.getElementById('btn_import');
    if (eventButton) {
        eventButton.addEventListener('click', function() {
            const file_upload_component = document.getElementById('import_file');
            if (file_upload_component) {
                file_upload_component.click();
            }
        });
    }
"></img>""".replace("\\n", "").replace("\\t", "")

return code

Make sure to add a domId ( Please add ids to perspective components for writing tests - #2 by ggross ) to both the component.

Above function used btn_import as a button and import_file as a file upload domId.

file_import_with_button

Better way to do would be Perspective Table Context Menu - activated rowData - #14 by nminchin after IA Stops the Injecting.