PDA

View Full Version : Grouped Lists



Blackfoot
January 7th, 2022, 09:25
I've been puttering with grouped lists in my sidebar windows and I did fine with tweaking existing ones but adding new ones seems to be eluding me a bit. I got the window to appear with the title and headers... but none of the data shows up even though the data shows in the sidebar window. Obviously there's a hook that I'm missing somewhere...


["maneuver"] = {
bExport = true,
aDataMap = { "maneuvers", "reference.standardmaneuvers", "reference.martialmaneuvers", "reference.optionalmaneuvers", "reference.advancedmartialmaneuvers" },
sRecordDisplayClass = "referencemaneuver",
aGMListButtons = { "button_maneuvers" },
sSidebarCategory = "library",
aCustomFilters = {
["Type"] = { sField = "type" },
["Action"] = { sField = "action" }
},
},

["maneuver"] = {
["bytype"] = {
aColumns = {
{ sName = "name", sType = "string", sHeadingRes = "maneuver_grouped_label_name", nWidth=150 },
{ sName = "action", sType = "string", sHeadingRes = "maneuver_grouped_label_action", bCentered=true },
{ sName = "pointcost", sType = "string", sHeadingRes = "maneuver_grouped_label_cost", bCentered=true },
{ sName = "ocv", sType = "string", sHeadingRes = "maneuver_grouped_label_ocvmod", bCentered=true },
{ sName = "dcv", sType = "string", sHeadingRes = "maneuver_grouped_label_dcvmod", bCentered=true },
{ sName = "short", sType = "string", sHeadingRes = "maneuver_grouped_label_short", bCentered=true },
},
aFilters = { { } },
aGroups = { { sDBField = "type" } },
aGroupValueOrder = { "Standard Maneuvers", "Optional Maneuvers", "Martial Maneuvers", "Advanced Martial Maneuvers", "Advanced Ranged Martial Maneuvers" },
},
},

<template name="button_maneuvers">
<button_text_sm>
<anchored to="buttonanchor" width="80">
<top />
<left anchor="right" relation="relative" offset="5" />
</anchored>
<state textres="library_recordview_label_maneuver_bytype" />
<script>
function onButtonPress()
local w = Interface.findWindow("reference_groupedlist", "reference.maneuver_bytype");
if w then
Interface.toggleWindow("reference_groupedlist", "reference.maneuver_bytype");
else
w = Interface.openWindow("reference_groupedlist", "reference.maneuver_bytype");
w.init({ sRecordType = "maneuver", sListView = "bytype" });
end
end
</script>
</button_text_sm>
</template>

Trenloe
January 7th, 2022, 16:02
Try changing aFilters = { { } }, to aFilters = { },

darrenan
January 7th, 2022, 18:28
The paths in the window script should be reference.maneuver not reference.maneuver_bytype

EDIT: nevermind, those data paths in the window script are irrelevant. Those nodes do get created, but it isn't pulling the data from there.

Trenloe
January 7th, 2022, 18:47
The paths in the window script should be reference.maneuver not reference.maneuver_bytype
In this case the grouped list is using a temporary data source when the window is opened - the code behind the reference_groupedlist windowclass builds the data. You can see a lot of these in the PFRPG2 ruleset, which makes extensive use of grouped lists - see campaign\template_campaign.xml.

Trenloe
January 7th, 2022, 18:58
Following up on this - using aFilters = { { } } in a default 5E grouped list actually raises an error - and so the grouped list is shown empty as the error stops the code that populates the window from running.

@Blackfoot - were you receiving an error? Something like this:


[ERROR] Script execution error: [string "ref/scripts/ref_groupedlist.lua"]:317: getValue: Invalid parameter 2

This is in standard CoreRPG code. If you're not getting an error, then you're probably not running the CoreRPG code correctly. But this is still probably your issue - use aFilters = { } as this is an empty LUA table, { {} } is not an empty LUA table, it contains one empty record.

Blackfoot
January 17th, 2022, 16:38
Sorry for not circling back on this. That did resolve the issue.

The only issue I'm having at this point is one of my group sorts isn't applying to the list... I figure there is some other factor in there I'm missing as the code looks identical to another one I have that is working... not at my machine right now so I can't show this... but.. I'm sure I'm missing something.