Execute additional javascript as document ready ? Or Table Editor with selected all lines by default

Hello all,

I want to view a table with all lines selected by default.
This is not configurable with the current Table Editor, so I want to do it with Generic JavaScript View, cf. attached workflow
Test_JS.knwf (10.6 KB)
However, this does not work ! I suppose that I mis-use the Generic JavaScript View node ?
Can someone please tell me how to pre-selected all the lines of the table at first view ? with JS or another way ?

Thanks in advance

Thanh Thanh

so far I have not managed to trigger this code when the iframe is loaded and the checkboxes are actually available, but this code sets them all to checked:

$(window.top.document).find("iframe").contents().find("iframe").contents().find("input[type=checkbox]").prop("checked", true);

This is necessary because there are some iframes in the window (one top level and one for each widget).
I simplified the selector a bit for readability. Feel free to change it back to yours. I will continue to search for a solution, but maybe you have an idea how to proceed from here.
Kind regards

1 Like

one more idea, not perfect, but working:

var token = setInterval(() => {
var inputs = $(window.top.document).find("iframe").contents().find("iframe").contents().find("input");
    if (inputs.length > 0) {
	    inputs.prop("checked", true);
}, 500);

This just checks for the iframes in 500ms intervals and when they are available sets the checkboxes.
Kind regards

//Edit: simplified code a bit

Hi Alexander,

Thanks for your answers.

I’ve tried the solution that you proposed. It works fine locally, but when I deploy the workflow on the Knime Server, it does not work. I do not really understand the difference ?!!!

However, I found this old thread Custom javascript functions in the HTML page generated by quick forms
And based on this, I made it works locally and also on the Knime server…

Thanks again and have a nice day!

Thanh Thanh