{"id":113,"date":"2009-05-07T11:36:59","date_gmt":"2009-05-07T11:36:59","guid":{"rendered":"http:\/\/www.myfatblog.co.uk\/?p=113"},"modified":"2009-05-07T11:37:53","modified_gmt":"2009-05-07T11:37:53","slug":"linked-list-items-revisited","status":"publish","type":"post","link":"http:\/\/www.myfatblog.co.uk\/index.php\/2009\/05\/linked-list-items-revisited\/","title":{"rendered":"Using JQuery to remove Linked List Items Hyperlinks &#8211; Revisited"},"content":{"rendered":"<p>So in an <a href=\"http:\/\/www.myfatblog.co.uk\/?p=106\">earlier post <\/a>I talked about using JQuery to remove the A tag that is automatically included in the rendering of a linked list item in display mode.<\/p>\n<p>I really liked this solution as it avoided having to go to the lengths of writing a custom field to solve this and can be targetted at a single page, or a whole site by embedding the code in the Master Page.<\/p>\n<p>So, anyway, it&#8217;s worked quite nicely at the client that instigated the investigation, so I decided to re-use the code for a new client. This has functioned perfectly, right up to the point where they used a list view with a Group by in the selected view.<\/p>\n<p>So, why does this cause different behaviour? Well the answer is in how the ListView web part handles the hiding and revealing of the grouped data. When you click on the expand link, the page performs a partial postback to SharePoint to get the missing data, before returning a block of HTML to display.<\/p>\n<p>As this happens during the partial postback, the already registered code on the page doesn&#8217;t run a second time as the jQuery event $(document).ready doesn&#8217;t trigger again.<\/p>\n<p>I tried various methods before placing a post on the EndUserSharePoint.com StumpThePanel Q&#038;A forum in the hope that &#8220;JQuery in SharePoint&#8221; god Paul Grenier would be able to answer my timing issues, which he did very nicely!<\/p>\n<p>So how did we resolve it.. The answer is to replace the MicroSoft function that handles the posted back data within the listview ExpGroupRenderData() with a JQuery version.<\/p>\n<pre lang=\"javascript\">\r\nfunction ExpGroupRenderData(htmlToRender, groupName, isLoaded) {\r\n\t$(\"#tbod\"+groupName+\"_\").attr(\"isloaded\",isLoaded)\r\n\t\t.html(htmlToRender)\r\n\t\t.show(\"fast\",HideLinkedListItems());\r\n}\r\n<\/pre>\n<p>HideLinkedListItems() is the previously created function to strip the A tag frm linked list items, wrapped in a function wrapper so that it can be called frm either the update, or the Document.ready as per the original post.<\/p>\n<p>The result, expanding the listview now presents the list view items, nicely stripped of their links.<\/p>\n<p>I hope this helps someone achieve the same..<\/p>\n<p>Paul.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>So in an earlier post I talked about using JQuery to remove the A tag that is automatically included in the rendering of a linked list item in display mode. I really liked this solution as it avoided having to go to the lengths of writing a custom field to solve this and can be &hellip; <\/p>\n<p><a class=\"more-link btn\" href=\"http:\/\/www.myfatblog.co.uk\/index.php\/2009\/05\/linked-list-items-revisited\/\">Continue reading<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_exactmetrics_skip_tracking":false,"_exactmetrics_sitenote_active":false,"_exactmetrics_sitenote_note":"","_exactmetrics_sitenote_category":0,"footnotes":""},"categories":[29,26,13,16,1],"tags":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v22.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Using JQuery to remove Linked List Items Hyperlinks - Revisited - Blog of an overweight SharePoint addict<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"http:\/\/www.myfatblog.co.uk\/index.php\/2009\/05\/linked-list-items-revisited\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Using JQuery to remove Linked List Items Hyperlinks - Revisited - Blog of an overweight SharePoint addict\" \/>\n<meta property=\"og:description\" content=\"So in an earlier post I talked about using JQuery to remove the A tag that is automatically included in the rendering of a linked list item in display mode. I really liked this solution as it avoided having to go to the lengths of writing a custom field to solve this and can be &hellip; Continue reading\" \/>\n<meta property=\"og:url\" content=\"http:\/\/www.myfatblog.co.uk\/index.php\/2009\/05\/linked-list-items-revisited\/\" \/>\n<meta property=\"og:site_name\" content=\"Blog of an overweight SharePoint addict\" \/>\n<meta property=\"article:published_time\" content=\"2009-05-07T11:36:59+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2009-05-07T11:37:53+00:00\" \/>\n<meta name=\"author\" content=\"Cimares\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@cimares\" \/>\n<meta name=\"twitter:site\" content=\"@cimares\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Cimares\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"http:\/\/www.myfatblog.co.uk\/index.php\/2009\/05\/linked-list-items-revisited\/\",\"url\":\"http:\/\/www.myfatblog.co.uk\/index.php\/2009\/05\/linked-list-items-revisited\/\",\"name\":\"Using JQuery to remove Linked List Items Hyperlinks - Revisited - Blog of an overweight SharePoint addict\",\"isPartOf\":{\"@id\":\"http:\/\/www.myfatblog.co.uk\/#website\"},\"datePublished\":\"2009-05-07T11:36:59+00:00\",\"dateModified\":\"2009-05-07T11:37:53+00:00\",\"author\":{\"@id\":\"http:\/\/www.myfatblog.co.uk\/#\/schema\/person\/55ae8f6885bb5b8390dad001f3da83c6\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"http:\/\/www.myfatblog.co.uk\/index.php\/2009\/05\/linked-list-items-revisited\/\"]}]},{\"@type\":\"WebSite\",\"@id\":\"http:\/\/www.myfatblog.co.uk\/#website\",\"url\":\"http:\/\/www.myfatblog.co.uk\/\",\"name\":\"Blog of an overweight SharePoint addict\",\"description\":\"The rantings of a (not so) food obsessed IT consultant!\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"http:\/\/www.myfatblog.co.uk\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"http:\/\/www.myfatblog.co.uk\/#\/schema\/person\/55ae8f6885bb5b8390dad001f3da83c6\",\"name\":\"Cimares\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"http:\/\/www.myfatblog.co.uk\/#\/schema\/person\/image\/\",\"url\":\"http:\/\/www.myfatblog.co.uk\/images\/BlogImages\/About_D057\/TopOfTheWorld.jpg\",\"contentUrl\":\"http:\/\/www.myfatblog.co.uk\/images\/BlogImages\/About_D057\/TopOfTheWorld.jpg\",\"caption\":\"Cimares\"},\"sameAs\":[\"http:\/\/www.myfatblog.co.uk\"],\"url\":\"http:\/\/www.myfatblog.co.uk\/index.php\/author\/reginald\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Using JQuery to remove Linked List Items Hyperlinks - Revisited - Blog of an overweight SharePoint addict","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"http:\/\/www.myfatblog.co.uk\/index.php\/2009\/05\/linked-list-items-revisited\/","og_locale":"en_US","og_type":"article","og_title":"Using JQuery to remove Linked List Items Hyperlinks - Revisited - Blog of an overweight SharePoint addict","og_description":"So in an earlier post I talked about using JQuery to remove the A tag that is automatically included in the rendering of a linked list item in display mode. I really liked this solution as it avoided having to go to the lengths of writing a custom field to solve this and can be &hellip; Continue reading","og_url":"http:\/\/www.myfatblog.co.uk\/index.php\/2009\/05\/linked-list-items-revisited\/","og_site_name":"Blog of an overweight SharePoint addict","article_published_time":"2009-05-07T11:36:59+00:00","article_modified_time":"2009-05-07T11:37:53+00:00","author":"Cimares","twitter_card":"summary_large_image","twitter_creator":"@cimares","twitter_site":"@cimares","twitter_misc":{"Written by":"Cimares","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"http:\/\/www.myfatblog.co.uk\/index.php\/2009\/05\/linked-list-items-revisited\/","url":"http:\/\/www.myfatblog.co.uk\/index.php\/2009\/05\/linked-list-items-revisited\/","name":"Using JQuery to remove Linked List Items Hyperlinks - Revisited - Blog of an overweight SharePoint addict","isPartOf":{"@id":"http:\/\/www.myfatblog.co.uk\/#website"},"datePublished":"2009-05-07T11:36:59+00:00","dateModified":"2009-05-07T11:37:53+00:00","author":{"@id":"http:\/\/www.myfatblog.co.uk\/#\/schema\/person\/55ae8f6885bb5b8390dad001f3da83c6"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["http:\/\/www.myfatblog.co.uk\/index.php\/2009\/05\/linked-list-items-revisited\/"]}]},{"@type":"WebSite","@id":"http:\/\/www.myfatblog.co.uk\/#website","url":"http:\/\/www.myfatblog.co.uk\/","name":"Blog of an overweight SharePoint addict","description":"The rantings of a (not so) food obsessed IT consultant!","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"http:\/\/www.myfatblog.co.uk\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Person","@id":"http:\/\/www.myfatblog.co.uk\/#\/schema\/person\/55ae8f6885bb5b8390dad001f3da83c6","name":"Cimares","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"http:\/\/www.myfatblog.co.uk\/#\/schema\/person\/image\/","url":"http:\/\/www.myfatblog.co.uk\/images\/BlogImages\/About_D057\/TopOfTheWorld.jpg","contentUrl":"http:\/\/www.myfatblog.co.uk\/images\/BlogImages\/About_D057\/TopOfTheWorld.jpg","caption":"Cimares"},"sameAs":["http:\/\/www.myfatblog.co.uk"],"url":"http:\/\/www.myfatblog.co.uk\/index.php\/author\/reginald\/"}]}},"_links":{"self":[{"href":"http:\/\/www.myfatblog.co.uk\/index.php\/wp-json\/wp\/v2\/posts\/113"}],"collection":[{"href":"http:\/\/www.myfatblog.co.uk\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.myfatblog.co.uk\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.myfatblog.co.uk\/index.php\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/www.myfatblog.co.uk\/index.php\/wp-json\/wp\/v2\/comments?post=113"}],"version-history":[{"count":0,"href":"http:\/\/www.myfatblog.co.uk\/index.php\/wp-json\/wp\/v2\/posts\/113\/revisions"}],"wp:attachment":[{"href":"http:\/\/www.myfatblog.co.uk\/index.php\/wp-json\/wp\/v2\/media?parent=113"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.myfatblog.co.uk\/index.php\/wp-json\/wp\/v2\/categories?post=113"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.myfatblog.co.uk\/index.php\/wp-json\/wp\/v2\/tags?post=113"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}