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.
This commit is contained in:
Brian Federle 2013-04-15 14:02:42 -07:00
parent 66a16a1fd3
commit a589a367d0
1 changed files with 5 additions and 1 deletions

View File

@ -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(
$('<input>').attr({
type: 'checkbox',
name: actionName
name: actionName,
checked: data && data._isSelected ?
'checked' : false
})
)
.attr({