From a589a367d07d01e22356d8eb123c9ed482e05c96 Mon Sep 17 00:00:00 2001 From: Brian Federle Date: Mon, 15 Apr 2013 14:02:42 -0700 Subject: [PATCH] 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. --- ui/scripts/ui/widgets/listView.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ui/scripts/ui/widgets/listView.js b/ui/scripts/ui/widgets/listView.js index c5e0561606f..4bd4a42dd8e 100644 --- a/ui/scripts/ui/widgets/listView.js +++ b/ui/scripts/ui/widgets/listView.js @@ -734,6 +734,8 @@ var makeActionIcons = function($td, actions, options) { options = options ? options : {}; var allowedActions = options.allowedActions; + var $tr = $td.closest('tr'); + var data = $tr && $tr.data('json-obj') ? $tr.data('json-obj') : null; $.each(actions, function(actionName, action) { if (actionName == 'add' || action.isHeader) @@ -766,7 +768,9 @@ .append( $('').attr({ type: 'checkbox', - name: actionName + name: actionName, + checked: data && data._isSelected ? + 'checked' : false }) ) .attr({