Timeline for Javascript to display sharepoint list items on page load
Current License: CC BY-SA 3.0
11 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Feb 5, 2012 at 13:20 | comment | added | Sergei Sergeev |
@omlin, I wanted to see not working code with _spBodyOnLoadFunctionNames , because provided github link contains only jQuery version. Common mistake with _spBodyOnLoadFunctionNames can bee passing function as parameter, instead of string name of that function.
|
|
Feb 5, 2012 at 10:54 | comment | added | Andrey Markeev |
@empo, I'm not arguing to this :) However, personally I used _spBodyOnLoadFunctionNames tens of times (if not hundreds) and I know that it is a workable solution. Thus I assume that something is wrong with your environment/code/whatever. For example, you don't need referencing sp.js with <SharePointWebControls:ScriptLink Name="SP.js" runat="server" OnDemand="true" Localizable="False" /> , and this code could be the one who causes the issue. Anyway, since it is not my answer, I'd prefer to leave further explorations and testing to @Kai :)
|
|
Feb 5, 2012 at 10:43 | comment | added | Emiliano Poggi | @omlin, no way to make it to work with javascript. Even trying to move the call in the head place holder. | |
Feb 5, 2012 at 10:41 | comment | added | Andrey Markeev | @Kai, he posted the code and provided the corresponding link to gist.github. Please, follow the link to see the code. And anyway, +1 for "SharePoint-way" :) While jQuery is not shipped with SharePoint, I believe avoiding it is a consistent intent. | |
Feb 5, 2012 at 10:12 | comment | added | Sergei Sergeev | I've tested, it works, could you please post your code, how do you use it? And if any javascript errors appears? | |
Feb 5, 2012 at 10:07 | comment | added | Emiliano Poggi |
I understand your observation but with _spBodyOnLoadFunctionNames does not work. It works only with jQuery.
|
|
Feb 5, 2012 at 10:04 | comment | added | Sergei Sergeev |
It seems that sharepoint also registers an event listener for window.onload , and you replace it with custom, it may the case of an unexpected behavior. You should use _spBodyOnLoadFunctionNames (which is also works) or jQuery document ready as @Vardhaman Deshpande suggests.
|
|
Feb 5, 2012 at 9:56 | comment | added | Emiliano Poggi | Thanks for your time. It works only with jQuery. See gist.github.com/1744459 for details. Are you able to tell me why? | |
Feb 5, 2012 at 9:54 | comment | added | Sergei Sergeev |
I've just tested it - it is not working with window.onload , but is working with _spBodyOnLoadFunctionNames
|
|
Feb 5, 2012 at 9:40 | comment | added | Sergei Sergeev |
Have you tried to use _spBodyOnLoadFunctionNames as I described?
|
|
Feb 5, 2012 at 8:07 | history | answered | Sergei Sergeev | CC BY-SA 3.0 |