Web part refresh causes sticky headers to disappear in sharepoint list

I embedded a snippet called "sticky headers" that freezes the column titles of a long sharepoint list so that when you scroll down, the column titles remain visible. However, I noticed that the "sticky headers" disappear when the web
part refreshes and reappear on a page refresh. How can I get the code to execute after any partial postbacks? Here is the code:
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js" type="text/javascript"></script><script
type="text/javascript">
jQuery(document).ready(function(){
stickyHeaders()
function stickyHeaders(){
if( jQuery.inArray( "spgantt.js", g_spPreFetchKeys ) > -1){
SP.SOD.executeOrDelayUntilScriptLoaded(function () {
findListsOnPage();
}, "spgantt.js");
} else {
findListsOnPage();
$(window).bind('hashchange', findListsOnPage);
function findListsOnPage() {
var lists         
= $('.ms-listviewtable')
var quickEditLists = [];
var listViews     
= [];
$(lists).each(function(i){
if($(this).find('div[id^="spgridcontainer"]').length > 0 ){
quickEditLists.push($(this))
} else if( $(this).hasClass("ms-listviewgrid") == false ) {
listViews.push($(this))
if(quickEditLists.length > 0) {
SP.GanttControl.WaitForGanttCreation(function (ganttChart) {
initializeStickyHeaders(quickEditLists, "qe");
if(listViews.length > 0) {
initializeStickyHeaders(listViews, "lv");
function initializeStickyHeaders (lists, type) {
var top_old       
= [], top_new        = [],
bottom_old    
= [], bottom_new     = [],
stickies      
= [], headers        = [],
indexOffset   
= 0 ;
var style = "" +
"" +
"" +
"background-color:white;" +
"box-shadow:3px 3px 5px #DDDDDD;" +
"display:none"
$(window).unbind('resize.' + type);
$(window).bind 
('resize.' + type, updatestickies );
$('#s4-workspace').unbind('scroll.' + type);
$('#s4-workspace').bind 
('scroll.' + type, updatestickies );
$(lists).each(function(){
headers.push($(this).find($('.ms-viewheadertr:visible')))
$(headers).each(function (i) {
var table = $(this).closest("table");
if(table.find("tbody > tr").length > 1) {
table.parent().find(".sticky-anchor").remove()
table.parent().find(".sticky").remove()       
var anchor = table.before('<div></div>')
stickies.push($(this).clone(true,true).addClass("sticky").attr('style', style).insertAfter(anchor))
var tbodies = $(this).parent("thead").siblings("tbody")
if(tbodies.length > 1) {
tbodies.bind("DOMAttrModified", function(){
setTimeout(function(){
$('#s4-workspace').trigger("scroll", true)
}, 250)
} else {
headers.splice(i-indexOffset,1)
indexOffset++;
//Do it once even without beeing triggered by an event
updatestickies();
function updatestickies (event, DOMchangeEvent) {
$(headers).each(function (i) {
if(DOMchangeEvent) {
width();
return false;
function width() {
stickies[i].width(headers[i].width()).find('th').each(function (j) {
$(this).width(headers[i].find('th:nth-child(' + (j+1) + ')').width())
top_old[i]   
= top_new[i]
top_new[i]   
= Math.round($(this).offset().top - 45)
bottom_old[i] = bottom_new[i]
bottom_new[i] = Math.round(top_new[i] - 30 + $(this).closest('table').height())
stickies[i].offset({
div[id^=WebPartWPQ]").offset().left)
if(top_old[i] >= 0 && top_new[i] <= 0 ||
bottom_old[i] <= 0 && bottom_new[i] >= 0 ||
top_old[i] === undefined && bottom_old[i] === undefined && top_new[i] < 0 && bottom_new[i]
> 0 ) {
width();
stickies[i].fadeIn();
} else if (top_old[i] <= 0 && top_new[i] >= 0 || bottom_old[i] >= 0 && bottom_new[i]
<= 0 ) {
stickies[i].fadeOut();
</script>

Hi,
I believe one of two things are happening, either when the webpart is refreshing, it is a simple ajax call and not a pull page reload, or on the post back, for some reason the list is loading slow enough that your document onReady call is firing too quick.
My suggestion is that instead of triggering your sticky header on document onready, trap the scroll event instead. OnScroll, check to see if the list table exists, if it it does, use "offset" to determine if the table is off the page. If it is
then make sure that the sticky header code has fired to make the headers in fact sticky. As soon as the table is no longer "off the page" then your headers should be reverted to their previous state.
This should not require an entire re-write of code, rather a little code to track and trap scroll instead.
Eric Overfield - PixelMill -
ericoverfield.com -
@EricOverfield

Similar Messages

  • How to display calendar in web part with selected month(jan,feb,march) in sharepoint 2013

    Hi All,
    How to display selected Month like jan,feb,march in single page with different webparts.
    I created 3 webparts and selected(jan,feb,march) but when page refreshes all webparts are displaying current month(December).
    Here i attached the screen shot, where December should be shown as (January and February)
    Kindly check and guide me in right track.
    Thanks
    Prabhat.
    Madhu Prabhat

    Hi,                                                             
    To develop a custom web part, you can take a look at the links below with steps in detail for a start:
    Creating Web Parts for SharePoint
    http://msdn.microsoft.com/en-us/library/ee231579.aspx
    Sharepoint 2013 Create a Visual Web Part
    http://raquelalineblog.wordpress.com/2013/04/25/sharepoint-2013-create-a-visual-web-part/
    Another three links for your reference:
    http://www.learningsharepoint.com/2012/12/24/how-to-create-a-custom-webpart-in-sharepoint-2013/?goback=%2Egde_3911588_member_198759022#%21
    http://www.youtube.com/watch?v=9iK8IPUB87w
    http://sptechbytes.blogspot.com/2013/10/sharepoint-2013-creating-visual-webpart_26.html
    Here are some samples of custom calendar web part for your reference:
    http://www.codeproject.com/Articles/108676/SharePoint-Custom-Calendar
    http://gunnarpeipman.com/2009/01/creating-sharepoint-global-calendar/
    https://blog.metrostarsystems.com/2013/10/21/creating-a-custom-sharepoint-calendar-rollup/
    You can also do more customization by adding your own logic in it.
    Best regards
    Patrick Liang
    TechNet Community Support

  • Excel web access web part Refresh

    Dear All,
    Please let me adress my SharePoint issues to you.
    Current situation:
    I currently have an excel file stored in one of my sharepoint libraries.
    The excel file has two tabs.
    The first tab contains data exported from a sharepoint list (with data connection)
    The second tab has a customized table based on the first tab.
    I created a page and added a Excel Web Access web part. The above mentioned excel file (tab2) is viewed in this web part.
    Problem:
    Everytime I change something in my sharepoint list, the changes will not be viewed in the web part. The changes will only view when I open the excel file in the library first, and then save it.
    Question:
    Is there a way I can refresh the data automatically, or manually without having to leave the page of the web part?
    If anyone has a solution please let me know, thank you for your help!
    Bob

    you can configure automatic data refresh.  fairly simple.  this article is for SQL data source, but the same process applies across the board.
    http://technet.microsoft.com/en-us/library/hh525341(v=office.15).aspx
    Christopher Webb | MCM: SharePoint 2010 | MCSM: SharePoint Charter | MCT | http://christophermichaelwebb.com

  • SQL Server Report services web part will cause lost page title

    Hello,
    I have a SSRS web part in my Sharepoint 2013 page, but I found the page title always lost after report load completed. I have checked the js code by debug, I found this is being caused by internal javascript executed by Sharepoint.
    The code as below:
    Sys$WebForms$PageRequestManager$_parseDelta(executor) {
    >var reply = executor.get_responseData();
    the code get pageTitle info is null, so cause page title lost.
    Can anyone help please?
    Thank you

    Hi Brysk,
    Is there any difference between the problemaitc page containing the webpart and other working wiki pages for showing the title name in IE tab?
    The IE tab should show the information in tag<title> of the page, please check if it is correct for that page (using F12).
    Also check if it is related to IE browser compatibility issue.
    Thanks
    Daniel Yang
    TechNet Community Support

  • Export to Excel is not working for List View Web Part after filtering using Query String parameters in SharePoint 2010

    Hi, 
    I am filtering SharePoint list view web part based on Query string parameter and I am doing Export to Excel by using following code.
    <a href="#" onclick="javascript:window.location='../_vti_bin/owssvr.dll?CS=109&Using=_layouts/query.iqy&List=0DC67399-BE11-48F3-ADFC-E911FB8B5845&View=54671412-3EFE-4281-835A-9EF747AE774E&CacheControl=1'"><img
    alt="Excel" src="/_layouts/images/icxlsx.gif" border="0"/>&nbsp;Export to Excel</a>
    Issue: Able to do Export to Excel when there are no filters applied on list view web part but if applied filters on web part and do export to excel , only header fields are displaying in the excel sheet.
    I don't know why owssvr.dll is behaving like that .
    Please share your ideas.
    Thanks in Advance.

    Hi,
    According to your post, my understanding is that you wanted to create hyperlink to export to excel.
    The URL to execute the export is as follows:
    {Site URL}/_vti_bin/owssvr.dll?CS=109&Using=_layouts/query.iqy&List={List GUID}&View={View GUID}&CacheControl=1
    After getting the GUID, you  need to “decode” the list GUID.
    Replace %7B with {
    Replace %2D with –
    Replace %7D with }
    More information:
    Create Link to Export Library Contents to Excel
    SharePoint - Create a link to export to Excel
    Best Regards,
    Linda Li
    Linda Li
    TechNet Community Support

  • How to enable a custom web part class file to be refreshed at regular interval of time, without affecting the entire page where its placed.

    Hi,
    I am calling a web service in the web part class file where it gets the data. I need to call the service at regular intervals of time which is in the web part, is there a way to get the web part refreshed automatically at certain intervals of time.
    Rayudu

    You can use Ajax for automatic refreshing.
    Add a timer control into an Ajax Update panel within your custom web part and execute your code to refresh the field values within the Timer_Tick() event.
    You can also control the timer interval to 10 minutes or so using the Timer.Interval property.
    This will always enable your page to remain with only the web parts getting refreshed.
    I just found
    a blog post which describes this in detail with screenshots.

  • Web Part - Report Viewer - Override Parameters are not saving

    When I select the override option and check the one parameter out of the list and click apply, or OK, the Web Part refreshes and resets the parameter list with all the items checked again.

    Hi Developer_46038,
    i tried this steps in sharepoint 2013 SP1,
    ·         A report
    viewer web part is added to a standard page
    ·         The parameters are loaded in the web part settings, and the option to
    override the default parameter is selected and overridden with the desired value.
    ·         After pressing OK, the
    report loads as expected.
    ·         After pressing "Stop Editing" on the page, the
    report still appears as expected.
    ·         If the page is reloaded, the
    parameters have been removed.
    seems the issue reproducible there, i already submit a request for checking, but i cannot make any guarantee regarding the time process.
    if should you need urgently, please open a ticket,
    http://support.microsoft.com
    Regards,
    Aries
    Microsoft Online Community Support
    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.

  • "One or more field types are not installed properly" when I try to add a second discussion board web part to a page

    I have a SharePoint 2010 site with two discussion boards. I added one additional field to each of the boards: a lookup to another list to link the discussions to individual projects. I need 2 different boards because they have different posting permissions
    (one is open to all for comments, and one is open only to the project team to post but everyone can read).
    When I go to the pages for each of the discussion boards, they work fine.
    But I'm putting together a page for individual projects, and want to have web parts for both discussion boards on the same page, showing the discussions related to the selected project.
    I am able to add one of the discussion boards to a web part in the page, but when I add the second discussion board to the page, the new web part contains:
    One or more field types are not installed properly. Go to the list settings page to delete these fields.
    Correlation ID: blah blah blah
    I've searched for similar postings, but mostly I see this error message related to migration from 2007 to 2010 -- this is not the case here: I created both discussion boards, and the whole site, in SP 2010. I've also found this message related
    to coding errors using SPQuery. I am not doing any coding here, just using the built-in SharePoint 2010 Edit Page -> add a web part -> select the discussion list.  I tried doing it from SPD with the same result. 

    I figured it out. I was using ?FilterField1=fieldname&FilterValue1=value on the URL to the page to pick out one project number. The web part I was trying to add was for a list that did not have that particular fieldname. I didn't realize that would matter
    since I was using the Connections -> Get Filter Values From to get my filter values from the main web part, which does have that fieldname.
    I added a field with that fieldname to the other list and set a workflow to copy the lookup value of the project number lookup field into the new field. Now all is working fine.  Sorry for the wild geese in my original question.

  • Sharepoint 2013 Discussion Board Web Part, Subject line link on Home Page does not link to the list view

    I am by no means a SharePoint developer, but I really wanted to customize the discussion board for my site - so I found this link: http://www.codeproject.com/Articles/733164/How-to-create-HelpDesk-on-SharePoint-Online
    I added the columns, like the article said, and then completed the section "Modification of the discussion board views".  I skipped the workflow stuff because while I think it would be useful I wanted to make sure I could get
    the actual customization of the discussion board to work first. 
    My Problem (Just to preface - I followed the above instructions, including disabling the Minimal Download Strategy):
    When I clicked into my discussion board list, I was able to get it to look and function as described for both the subject and flat views. However, when I click on the Subject, from the Discussion Board Web Part on my Home Page, it does not redirect into the
    Discussion Board List Flat View.  Instead, it tries to open the root folder from the Home Page while still using the subject view.  The outcome being an empty discussion board on the Home Page.
    So I decided to create a whole new discussion board to see if that one would work, when I inserted a new Discussion Board Web Part into the Home Page, newly created from the app menu, it used the same custom JS file(plumTickets), even though I never linked
    the discussion board to the JS file. Of course when I went into the newly created Discussion Board list it opened as it does OOTB.
    I am so close it having this work like I have been envisioning.  I just need users to be able to click on a discussion subject from the Home Page and be redirected to the list view of the parent folder (I think that is the correct terminology,
    but it may not be) so they would be able to see any replies and be able to reply.  Please Help Me!!!
    I truly appreciate any help you are able to provide, thank you!

    I figured it out. I was using ?FilterField1=fieldname&FilterValue1=value on the URL to the page to pick out one project number. The web part I was trying to add was for a list that did not have that particular fieldname. I didn't realize that would matter
    since I was using the Connections -> Get Filter Values From to get my filter values from the main web part, which does have that fieldname.
    I added a field with that fieldname to the other list and set a workflow to copy the lookup value of the project number lookup field into the new field. Now all is working fine.  Sorry for the wild geese in my original question.

  • SP2013 - Date Filter Web Part looses connection when used in a site template

    Hi,
    I created two table reports in SQL Reporting Services 2012 and inserted in a web page using the Reporting Service Report viewer in SharePoint 2013 with CU Dez 2013. The two reports require two dates and I use two date filter web parts (I did not try the
    date range solution I saw in the fórum).
    So the user inputs the two dates in date filters that send the information to thereports in the same page.
    They work in the site and I saved it as template. However when I create e new site using it as a templates, the date filter connections are broken and of course, they did not work.
    For another report where I usea text filter, it worked without any problem in the template.
    Does anybody know any workaround?
    Thank you.
    Best regards, Ricardo Segawa - Segawas Projetos / Microsoft Partner

    Hi ,
    The new site based on the saved site template will generate new ID for date filter web part, in the web part page the SPWebPartConnection "ProviderID" value seems still to reference the original date filter web part ID (see from
    SharePoint Designer), as a workaround we can re-configure the web part connection from the web part page manually or programmatically from that new site web part page.
    http://social.technet.microsoft.com/Forums/sharepoint/en-US/8d98206d-b41f-4ee4-b537-a4bf5cec0434/sharepoint-2010-save-site-as-template-webpart-connections-broken?forum=sharepointgeneralprevious
    http://sympmarc.com/2007/09/20/removing-a-web-part-connection-in-sharepoint/
    Thank
    Daniel Yang
    TechNet Community Support

  • Content Search Web Part Has No Results

    Hello,
    I have been working on a site for a few weeks now and have been trying to make a simple Image Slider. I have found many tutorials and all are helpful -- except I get stuck at the same part every time. I am trying to use a Content Search Web Part in order
    to pull images from a library/list and display them. I go through almost the same instructions every time but my query never shows any results.
    I have went in to 'Change Query' and set the following:
    Select a query: Pictures (System)
    Restrict By App: Specify a URL --> Then changed to mysite/myimagelibrary
    I have tried a few things. I have changed the Result Source to multiple different things, including the default 'Recently Changed Items.' I have also tried to put the images in a list rather than a Picture Library. I have also tried MANY different ways of
    putting in the 'specific URL.'
    I don't know why I can't seem to get results from my query. Any help or suggestions would be appreciated. Thank you.

    Hi,According to your post, my understanding is that you used a Content Search Web part to search images from a library/list , it didn’t display any
    Results.
    Please check which content type you used for these images . Maybe its content type is document rather than picture. Please make sure your images’ content type is picture.
    You can go in to 'Change Query' and set the following:
    Select a query: Items matching a content type(System)
    Restrict by App: Current site
    Restrict by content type: Picture
    As you have mentioned in your description “Specify a URL --> Then changed to mysite/myimagelibrary”.
    Here is a similar issue, you can use as a reference:
    http://social.technet.microsoft.com/forums/sharepoint/en-US/4a683be5-354d-4497-88da-672dd6335358/content-by-search-web-part-shows-no-results
    If the issue still exists, please feel free to let me know.
    Best Regards,
    Lisa Chen

  • Search Results Web Part, Managed Navigation and Paging

    I am using managed navigation and have a search results web part that uses the Term.IdWithChildren as the query to filter the results by the selected navigation term. This works nicely until you need to us the paging. As soon as you go to the next page there are
    no results.
    It would appear that as soon as the URL has the #k=#s=11 added it looses the navigation term. This is a core part of the Sharepoint solution that I'm delivering and I cannot progress this any further and I'm going round in circles. I have another results
    page that has the search results webpart on but doesn't use the navigation term filtering and the paging works fine.
    As an alternative I was looking at writing my own search results web part, can I do this and render the sharepoint display templates somehow?
    Any help would be appreciated.
    Stuart

    Hi Stuart, 
    i suppose you may need to check your design regarding this custom coding, 
    as i know, when i tried previously, i didn't take any attention on the query result, so that it appear as no result. 
    please have a check this links, it helped me once, 
    http://technet.microsoft.com/en-us/library/gg549981.aspx
    http://social.technet.microsoft.com/Forums/sharepoint/en-US/59e6e258-294d-44b2-996a-547e4e9f519d/customize-search-statistics-and-search-paging-web-parts
    http://kamilmka.wordpress.com/2012/04/14/customize-sharepoint-search-results-paging/http://blogs.msdn.com/b/sanjaynarang/archive/2009/02/20/handling-paging-and-total-results-count-in-sharepoint-custom-results-page.aspx
    Regards,
    Aries
    Microsoft Online Community Support
    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.

  • How to prevent RSS Viewer web part from overriding list-item CSS style?

    I am using SharePoint Online. I have a web part page with a number of web parts with links. Font size of the links is ~12px.
    If I add an RSS Viewer web part to the page, then it overrides the 'list-item' class CSS Style to something like 8px, which is unreadable.
    To correct this I have tried the following:
    1. Added the following code to a Script Editor Web Part on same page:
    <style type="text/css">
    .item link-item
    font-size:20px !important;
    .link-item
    font-size:20px !important;
    </style>
    2. Completely deleted all XSL from the RSS Viewer web part and replaced it with very simple formatting code which format the links within the RSS web part to 16px - but still the other links are set to 8px.
    3. Linked a custom style sheet to the relevant master page and set the link-item classes in there, ensuring that it is executed after the standard SharePoint css.
    ...but nothing works!
    It appears that, as soon as the RSS Viewer web part is added to the page it overrides the list-item style and then will not release it even if all the XSL within the web part is deleted!
    On deleting the RSS Viewer from the page and saving it, the links font size returns to normal.
    Does anyone have a fix/work around for this?
    Thanks in advance,
    Jimmy

    Hi Jimmy,
    I recommend to use “.link-item a” instead as the code below to change the font size of the links:
    <style>
    .link-item a
    font-size:20px !important;
    </style>
    And I tested the code above in my environment and it worked fine.
    Best regards,
    Thanks
    Victoria Xia
    TechNet Community Support

  • Steps required to create apps to implement various web parts functionality

    I have office 365 E3 a/c.
    For a site we have to create few apps whoose required functionality is like
    1. Newsfeed Webpart
    2. Blog webpart (source is library)
    3. CQWP
    4. Carousel web part
    5. Calendar control
    Please tell all steps required to create apps for above mentioned functionality.
    What will be steps and plan for this?

    Hi,
    According to your post, my understanding is that you want to create apps to implement various web parts functionality.
    You can use CQWP in the SharePoint Online. You can refer to:
    When to use the Content Query Web Part or the Content Search Web Part in SharePoint - SharePoint Online for enterprises
    In addition, there are some great articles about other web part for your reference:
    Data Viewer App for SharePoint Online
    Corporate News App
    Creating a SharePoint Cloud Business App Step by Step!
    Blog - Deploy A LightSwitch Application To Office 365 / SharePoint Online (Provider Hosted)
    Best Regards,
    Linda Li
    Linda Li
    TechNet Community Support

  • Business Data List Web Part

    Hi all,
    I am using the Business Data List Web Part to show and search data from external database as following link
    http://msdn.microsoft.com/en-us/library/office/ms493107(v=office.12).aspx
    But the Business Data List Web Part doesn't allow me to choose one or multiple items as other SP lists. I mean it doesn't have the CheckBox column. How could I have it?
    Thanks

    Hi,
    According to your description, Business Data List Web Part which data from external database doesn't have the check box column.
    I have done a test in my SharePoint 2013, and I met the same issue with you. Although I defined the edit action for the external content types, I still couldn’t edit a record from business data list web part.
    I would suggest you to use External List. In this case you will be able to Add/Edit/View item if your External Content Type has all operations.
    Here is a blog about how to Create an External List, you can use as a reference:
    http://community.bamboosolutions.com/blogs/sharepoint-2013/archive/2013/01/07/how-to-create-external-list-including-database-from-sharepoint-designer-2013.aspx
    beside, here is a similar post, you can use as a reference:
    https://social.technet.microsoft.com/forums/sharepoint/en-US/1a958e61-2c73-472c-83c7-443466aefcf8/edit-item-in-business-datra-list-webpart
    Best Regards,
    Lisa Chen
    Lisa Chen
    TechNet Community Support

Maybe you are looking for