Skip to content

Commit a589a36

Browse files
committed
List view UI: Support pre-selected checkboxes
In listings with checkbox actions, if _isSelected: true is passed in a data item, then pre-select the checkbox on load.
1 parent 66a16a1 commit a589a36

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

ui/scripts/ui/widgets/listView.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -734,6 +734,8 @@
734734
var makeActionIcons = function($td, actions, options) {
735735
options = options ? options : {};
736736
var allowedActions = options.allowedActions;
737+
var $tr = $td.closest('tr');
738+
var data = $tr && $tr.data('json-obj') ? $tr.data('json-obj') : null;
737739

738740
$.each(actions, function(actionName, action) {
739741
if (actionName == 'add' || action.isHeader)
@@ -766,7 +768,9 @@
766768
.append(
767769
$('<input>').attr({
768770
type: 'checkbox',
769-
name: actionName
771+
name: actionName,
772+
checked: data && data._isSelected ?
773+
'checked' : false
770774
})
771775
)
772776
.attr({

0 commit comments

Comments
 (0)