Module:NavboxMobile: Difference between revisions
EnWikiAdmin (talk | contribs) No edit summary |
EnWikiAdmin (talk | contribs) No edit summary |
||
Line 280: | Line 280: | ||
local function renderListRow(tbl, path, parentLevel) | local function renderListRow(tbl, path, parentLevel) | ||
-- Initialize path and parentLevel | |||
path = path or "" | path = path or "" | ||
parentLevel = parentLevel or 2 -- Start at level 2 for child groups | parentLevel = parentLevel or 2 -- Start at level 2 for child groups | ||
-- Keep track of rendered children to avoid duplicates | |||
local renderedChildren = {} | |||
for i = 1, 10 do | for i = 1, 10 do | ||
Line 287: | Line 291: | ||
local listKey = (path ~= "" and "child" .. path .. "_" or "") .. "list" .. i | local listKey = (path ~= "" and "child" .. path .. "_" or "") .. "list" .. i | ||
if args[groupKey] then | -- Skip if this group has already been rendered | ||
if not renderedChildren[groupKey] and args[groupKey] then | |||
renderedChildren[groupKey] = true -- Mark as rendered | |||
-- Render the group (heading) | -- Render the group (heading) | ||
local groupRow = addTableRow(tbl) | local groupRow = addTableRow(tbl) | ||
Line 331: | Line 338: | ||
end | end | ||
end | end | ||