SOLVED

SPFx Webpart panel properties: stop executing my code until I close you!

%3CLINGO-SUB%20id%3D%22lingo-sub-67380%22%20slang%3D%22en-US%22%3ESPFx%20Webpart%20panel%20properties%3A%20stop%20executing%20my%20code%20until%20I%20close%20you!%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-67380%22%20slang%3D%22en-US%22%3E%3CP%3EMaybe%20I'm%20missing%20something%3F%20%26nbsp%3BIn%20classic%20server-side%20web%20parts%2C%20users%20can%20configure%20a%20web%20part's%20properties%20and%20they%20aren't%20applied%20until%20the%20Apply%20or%20OK%20button%20at%20the%20bottom%20of%20the%20property%20panel%20is%20pressed.%20The%20new%20SPFx%20web%20part%20I%20am%20building%20seems%20to%20apply%20the%20values%20as%20soon%20as%20any%20keys%20are%20pressed%20in%20the%20property%20text%20box.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20am%20building%20a%20web%20part%20that%20queries%20a%20field%20in%20a%20list%20and%20returns%20and%20displays%20all%20items%20that%20match%20a%20%26nbsp%3Bproperty%20value%20in%20the%20web%20part.%20%26nbsp%3BThe%20idea%20is%20that%20there%20can%20be%20multiple%20instances%20of%20the%20web%20part%20in%20the%20site%2C%20all%20getting%20their%20data%20from%20the%20same%20list%2C%20but%20showing%20different%20results%20because%20each%20instance%20is%20configured%20with%20a%20different%20query%20key%20value.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EWhen%20running%20in%20the%20chrome%20debugger%2C%20I%20can%20see%20that%20%26nbsp%3Bmy%20code%20is%20executing%20every%20time%20I%20enter%20each%20letter.%20Obviously%2C%20nothing%20is%20going%20to%20be%20found%20with%20a%20partial%20key%20value%2C%20so%20it%20is%20useless%20to%20go%20off%20and%20query%20the%20list%20every%20time%20a%20new%20letter%20is%20added%20to%20the%20key%20value.%20I%20want%20to%20be%20able%20to%20enter%20the%20entire%20value%20and%20then%20%22apply%22%20it%20like%20I%20used%20to%20be%20able%20to%2C%20so%20the%20code%20only%20runs%20once.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIs%20there%20a%20way%20to%20do%20this%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-68572%22%20slang%3D%22en-US%22%3ERe%3A%20RE%3A%20SPFx%20Webpart%20panel%20properties%3A%20stop%20executing%20my%20code%20until%20I%20close%20you!%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-68572%22%20slang%3D%22en-US%22%3E%3CP%3EVelin%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks%20much.%20%26nbsp%3BObviously%20your%20Google-fu%20is%20stronger%20than%20mine.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-68305%22%20slang%3D%22en-US%22%3ERE%3A%20SPFx%20Webpart%20panel%20properties%3A%20stop%20executing%20my%20code%20until%20I%20close%20you!%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-68305%22%20slang%3D%22en-US%22%3EThere%20is%20your%20answer%20%3CA%20href%3D%22https%3A%2F%2Fblog.mastykarz.nl%2Fsharepoint-framework-client-side-web-parts-non-reactive-property-pane%2F%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fblog.mastykarz.nl%2Fsharepoint-framework-client-side-web-parts-non-reactive-property-pane%2F%3C%2FA%3E%3C%2FLINGO-BODY%3E
Highlighted
Contributor

Maybe I'm missing something?  In classic server-side web parts, users can configure a web part's properties and they aren't applied until the Apply or OK button at the bottom of the property panel is pressed. The new SPFx web part I am building seems to apply the values as soon as any keys are pressed in the property text box.

 

I am building a web part that queries a field in a list and returns and displays all items that match a  property value in the web part.  The idea is that there can be multiple instances of the web part in the site, all getting their data from the same list, but showing different results because each instance is configured with a different query key value.

 

When running in the chrome debugger, I can see that  my code is executing every time I enter each letter. Obviously, nothing is going to be found with a partial key value, so it is useless to go off and query the list every time a new letter is added to the key value. I want to be able to enter the entire value and then "apply" it like I used to be able to, so the code only runs once.

 

Is there a way to do this?

2 Replies
Highlighted
Highlighted

Velin,

 

Thanks much.  Obviously your Google-fu is stronger than mine.