Get the Correct List for the Spfx ListView Extension

%3CLINGO-SUB%20id%3D%22lingo-sub-1109788%22%20slang%3D%22en-US%22%3EGet%20the%20Correct%20List%20for%20the%20Spfx%20ListView%20Extension%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1109788%22%20slang%3D%22en-US%22%3E%3CP%3EHi%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EWhen%20using%26nbsp%3B%3C%2FP%3E%3CDIV%3E%3CDIV%3E%3CSPAN%3Ethis%3C%2FSPAN%3E%3CSPAN%3E.%3C%2FSPAN%3E%3CSPAN%3Econtext%3C%2FSPAN%3E%3CSPAN%3E.%3C%2FSPAN%3E%3CSPAN%3EpageContext%3C%2FSPAN%3E%3CSPAN%3E.%3C%2FSPAN%3E%3CSPAN%3ElegacyPageContext%3C%2FSPAN%3E%3CSPAN%3E.%3C%2FSPAN%3E%3CSPAN%3Elist%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3Ein%20a%20spfx%20ListView%20extension%20it%20references%20the%20list%20when%20you%20open%20the%20listname%2FAllItems.aspx%26nbsp%3B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%3CSPAN%3EWhen%20you%20put%20a%20list%20web%20part%20in%20another%20page%20with%20the%20list%20toolbar%20visible%20the%20extension%20buttons%20show%20up%2C%20but%20then%26nbsp%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%3CDIV%3E%3CDIV%3E%3CSPAN%3Ethis%3C%2FSPAN%3E%3CSPAN%3E.%3C%2FSPAN%3E%3CSPAN%3Econtext%3C%2FSPAN%3E%3CSPAN%3E.%3C%2FSPAN%3E%3CSPAN%3EpageContext%3C%2FSPAN%3E%3CSPAN%3E.%3C%2FSPAN%3E%3CSPAN%3ElegacyPageContext%3C%2FSPAN%3E%3CSPAN%3E.%3C%2FSPAN%3E%3CSPAN%3Elist%20reference%20the%26nbsp%3BSitePages%20library%20and%20not%20the%20list%20the%20extension%20is%20supposed%20to%20do%20operations%20on.%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3EHow%20to%20get%20the%20correct%20list%3F%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3C%2FDIV%3E%3C%2FDIV%3E%3C%2FDIV%3E%3C%2FLINGO-BODY%3E
Senior Member

Hi,

 

When using 

this.context.pageContext.legacyPageContext.list
in a spfx ListView extension it references the list when you open the listname/AllItems.aspx 
When you put a list web part in another page with the list toolbar visible the extension buttons show up, but then 
this.context.pageContext.legacyPageContext.list reference the SitePages library and not the list the extension is supposed to do operations on.
 
How to get the correct list?
 
0 Replies