1

I am having some issues with displaying a (single) list item on a Sharepoint webpart page, I am using Sharepoint online. The page consists of 4 squares, and one of them I want to use to display a listitem.

The problem is I can't achieve that, I only have access to Sharepoint Designer and the Sharepoint Online environment. I have already searched the internet but haven't found a solution (yet). I have already tried to insert it via insert (in Sharepoint Designer) >> Custom list form >> selecting the list and press OK. This mostly returns only in errors (page is not working anymore or is moved?).

What is the best way to achieve this?

  • will that item be static? or somehow dynamically changed? – Danilo Aug 15 '17 at 7:52
  • Hi Danilo, it has to be somehow dynamic based on a queryparameter. And I have to style the item and display the columns vertically. I think I am going to approach this problem with Javascript/AJAX. – Sander Aug 15 '17 at 7:57
  • For vertical view, you can create OOTB standard view with changing Style feature of your view, from Basic Table to Preview Pane. And for dynamically filtering you can modify view's filter feature. – Danilo Aug 15 '17 at 8:05
  • Hi, I managed to display the list on a page but somehow the list is not positioned where I want it. I placed the "WebPartPages:DataFormWebPart"into a div tag, but it's placed somewhere else on the page. – Sander Aug 15 '17 at 8:32
1

You could use front end development to achieve what you want however based on what you've mentioned it feels like overkill. the 2 solutions below are incredibly easy to implement and will achieve displaying a list item on a web part page. Feel free to elaborate on your requirements if I've missed anything.

  • Create a view on the list that isolates the 1 record you wish to display - i.e. filter by ID of your record. serve that view to the web part.
  • Use a content query web part that queries the list where your item is stored and again apply a filter with the ID of the record. At least this doesn't require an extra view.
  • Hello Max, thanks for your quick reply. If I do what you suggested, is it still possible to "style" the item? I have to display the columns vertically and display some linked list items (one to many). I am also condidering a Javascript/AJAX implementation to achieve what I want. But if there is a out of the box Sharepoint solution is available I prefer that. – Sander Aug 15 '17 at 7:08
  • You can use JSLink to override the template for the web part and display it however you want. There isn't any OOTB solution i can think of that wont require some kind of coding. You could also create a display template and apply that to the content query web part. In my experience the easiest method that will give you the ability to style your item would be the JSLink file. The added benefit of the JSLink file is that you can consume it on other web parts giving you some re-usability for your efforts. – max fuller Aug 15 '17 at 9:34
  • Hey Sander, just wanted to see how you got on with JSLink and if you need any help with the code for the JSLink feel free to open a new question – max fuller Aug 17 '17 at 4:34
  • Thanks for your concern Max, I have managed to do it with a form based on the list. Via this way I can style the page via XSL. At this moment it's working perfect! – Sander Aug 17 '17 at 14:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.