I found so little info on StateInitDone out there I would like some confirmation.
I have code in the CSR OnPostRender
which creates (non-CSR) DOM elements (easter-eggs) on screen;
I have dealt with all the MDS navigation issues using the asyncDeltaManager
beginRequest
& endRequest
functions, they make it so DOM elements are only visible on the one page (DOM elements are not removed on MDS navigation)
letter I : pronounced as 'ei' in the Dutch language meaning 'egg'
That all works with only 3 JSLinks to one external (private CDN) JS file (SharePoint Online can): https://www.youtube.com/embed/jsQVSR6WOQ8
Next problem:
Clicking a check-box fires the OnPostRender
(ofcourse), which is fine for CSR content,
but I do not want my custom stuff to run again.
Note: Whereas OnLoad the
OnPostRender
fires for all WebParts on screenonclick only the
OnPostRender
for the associated WebPart is executed.
The ctx object gives 2 promising named keys:
onDataRefreshCompleted with a whopping (but useless) one Google result
StateInitDone with 500% more (but still useless) Google search Results
On tracing, ctx.StateInitDone
seems to be false in OnPostRender, also in MDS navigation.
It is true once the page has finished (and remains so on checkbox interactions)
So I now have in OnPostRender
:
if (!ctx.StateInitDone) iCSR.iHunt.hideEggBehind(ctx.view);
the function itself does the check if DOMcontent needs to be added
Questions
- I can't find any Microsoft references;
https://social.technet.microsoft.com/search/en-US?refinement=145&query=StateInitDone
what does this value do (more)? - any other methods to work with non-CSR content?
- just curious... onDataRefreshCompleted anyone?
Another SharePoint bug that cropped up, those Checboxes are also displayed for user who do not have edit rigths...