Repository: cloudstack
Updated Branches:
  refs/heads/master 2c810d73e -> 35d5621bd


List view: Support rendering data cells as a list

If array is passed in field data, render the table cell as a list.

Example:

dataProvider: function(args) {
    args.response.success({ data: [ fieldA: ['i1', 'i2', ...] ] })
}


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/c769b32e
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/c769b32e
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/c769b32e

Branch: refs/heads/master
Commit: c769b32e70382fe1063e78a73c5e7880e3dca7a6
Parents: 2c810d7
Author: Brian Federle <brian.fede...@citrix.com>
Authored: Thu May 22 15:08:06 2014 -0700
Committer: Brian Federle <brian.fede...@citrix.com>
Committed: Thu May 22 15:10:33 2014 -0700

----------------------------------------------------------------------
 ui/scripts/ui/widgets/listView.js | 20 +++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c769b32e/ui/scripts/ui/widgets/listView.js
----------------------------------------------------------------------
diff --git a/ui/scripts/ui/widgets/listView.js 
b/ui/scripts/ui/widgets/listView.js
index d5ba2fe..f6d5a27 100644
--- a/ui/scripts/ui/widgets/listView.js
+++ b/ui/scripts/ui/widgets/listView.js
@@ -1117,9 +1117,23 @@
                     createEditField($td).appendTo($td);
                 } else {
                     $td.html('');
-                    $td.append(
-                        $('<span></span>').html(_s(content))
-                    );
+
+                    if ($.isArray(content)) {
+                        var $ul = $('<ul>');
+
+                        $(content).map(function (index, contentItem) {
+                            var $li = $('<li>');
+
+                            $li.append('<span>').text(contentItem.toString());
+                            $li.appendTo($ul);
+                        });
+
+                        $ul.appendTo($td);
+                    } else {
+                        $td.append(
+                            $('<span>').html(_s(content))
+                        );
+                    }
                 }
 
                 $td.attr('title', _s(content));

Reply via email to