Jump to content

How To Pre-Check Checkboxes Matching Criteria For Bulk Edit


Recommended Posts

The script below can be inserted into a footer. It preselects all rows with a value greater than 1, so that they can be Bulk Edited.

 

It loops for a field in a tabular datapage with a class of cbResultSetTableCellNumberDate, and then it looks for the value of the text of those cells that match. On my datapage, I have just 1 column with numerical data, so I don't need a more specific selector than that...

 

Then, it jumps up to the Row of the matching cell, then down to the first element in the Row (the cell that holds the checkbox), then down again to the checkbox itself, then uses a click event to check the box.

 

To make use of Bulk Edit, a click event must be used, and not 

document.getElementById("checkbox").checked = true;

    because Bulk Edit is grayed out until there is a click (not a change) event.

 

 

<script type="text/javascript">

 

var elems = document.querySelectorAll(".cbResultSetTableCellNumberDate");

for (var i=0, m=elems.length; i<m; i++) {

 if (elems.innerText >= 1) {  

elems.parentNode.firstChild.firstChild.click();

}

    }

 

</script>

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...