我有一个DataFrame,看起来像这样
<ul class="dropdown-menu" aria-labelledby="topnavDocumentation" id="myDropdown">
//Just removed <li></li> from here
</ul>
<script>
$(function () {
$.getJSON('dashtrend.json', function (loadMainItem) {
$.each(loadMainItem.data, function (i, f) {
var makemenu = "<li class='dropright'><a href='#' class='dropdown-item dropdown-toggle' id='" + f.id + "' role='button' data-toggle='dropdown' aria-haspopup='true' aria-expanded='false'>" + f.text + "</a>";
makemenu += "<div class='dropdown-menu' aria-labelledby='test'>";
$.each(f.items, function (j) {
makemenu += "<a class='dropdown-item' href='" + f.items[j].navigationurl + "'>" + f.items[j].text + "</a>";
})
makemenu += "</div></li>";
// <div class="dropdown-menu" aria-labelledby="ups4">
// <a class="dropdown-item" href="/Ups/UpsDashboard?upsid=1">Dashboard</a>
// <a class="dropdown-item" href="/Ups/Trends?id=1">Battery Trends</a>
// </div>
$(makemenu).appendTo("#myDropdown");
});
});
});
</script>
从长格式转换为宽格式的结果。
我想得到像这样的东西。