diff --git a/ui/scripts/ui/widgets/listView.js b/ui/scripts/ui/widgets/listView.js index a1e9a95f365..304e0350323 100644 --- a/ui/scripts/ui/widgets/listView.js +++ b/ui/scripts/ui/widgets/listView.js @@ -844,7 +844,10 @@ var rows = []; var reorder = options.reorder; var detailView = options.detailView; - var uiCustom = $tbody.closest('.list-view').data('view-args').uiCustom; + var $listView = $tbody.closest('.list-view'); + var listViewArgs = $listView.data('view-args'); + var uiCustom = listViewArgs.uiCustom; + var subselect = uiCustom ? listViewArgs.listView.subselect : null; if (!data || ($.isArray(data) && !data.length)) { if (!$tbody.find('tr').size()) { @@ -1041,6 +1044,54 @@ $listView.trigger('cloudStack.listView.addRow', { $tr: $tr }); } + // Add sub-select + if (subselect) { + var $td = $tr.find('td.first'); + var $select = $('
').addClass('subselect').append( + $('') - ).hide(); - var $selectionArea = $tr.find('td:last').find('input'); - - $td.append($select); - - // Show and populate selection - $selectionArea.change(function() { - if ($(this).is(':checked')) { - // Populate data - instances.listView.subselect({ - context: $.extend(true, {}, context, { - instances: [$tr.data('json-obj')] - }), - response: { - success: function(args) { - var data = args.data; - - if (data.length) { - $(data).map(function(index, item) { - var $option = $('