Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

The 'add new item' link which is always located at the end of the list. Is there a way that we can add a similar link at the top of the list?

share|improve this question
add comment

6 Answers 6

up vote 3 down vote accepted

Not possible by just configuring web part. Of course you could modify the Title Url of the web part to point to the Add new item URL, but I don't count that as a valid suggestion ;)

I would use javascript (jQuery) to search for the bottom Add new item link and inject similar to the correct position below the web part title.

Some web parts also allow you to edit the XSL of the web part. I haven't tried this myself, but you might be able to achieve the same in certain web parts using this method.

jQuery example (not on my dev machine now, so will share the idea at least):

  1. Find the Add new item node using ID and get it's html: $('table[summary='yourtablename'] td[class='ms-addnew']).html()
  2. Find the web part table, it should have "summary" attribute that might be easiest to find $('table[summary='yourtablename'])
  3. Append the Add new item TD you got from step 1 wherever you wish, or get the TR above that TD and append the row below/above column header row of the table
  4. You may want to change the ID attribute of the actual link to some other as there might be conflicts if you have two links with same ID attribute in HTML)
share|improve this answer
    
Hi Jussi, could u provide a example as to getting the "add new item" link using jquery –  spStacker Jan 31 '12 at 15:23
    
Hi, edited the answer above. –  Jussi Palo Feb 1 '12 at 21:12
    
Thanks jussi for the reply.i will try it at work tomorrow –  spStacker Feb 2 '12 at 3:55
add comment

You can edit the page to add a Content Editor Web Part up top and adjust the chrome type so that title / borders / etc don't display. Then edit the content of the web part to be a hyperlink to the same place as the other one.

share|improve this answer
add comment

You can keep the existing Add new item link at the bottom of the page and add an additional link above your list.

Add Content Editor web part above your list.

Copy the HTML markup from the existing Add new item link.

Example:

<SPAN style="POSITION: relative; WIDTH: 10px; DISPLAY: inline-block; HEIGHT: 10px;    OVERFLOW: hidden" class=s4-clust><IMG style="POSITION: absolute; TOP: -128px !important; LEFT: 0px !important" alt="" src="/_layouts/images/fgimg.png"></SPAN>
<A id=idHomePageNewItem class=ms-addnew onclick='javascript:NewItem2(event, "http://{sharepointurl}/_layouts/listform.aspx?PageType=8&amp;ListId={E02C7414-96AC-4E3D-A00E-0693BE227241}&amp;RootFolder=");javascript:return false;' href="http://{sharepointurl}/_layouts/listform.aspx?PageType=8&amp;ListId={E02C7414-96AC-4E3D-A00E-0693BE227241}&amp;RootFolder=" target=_self>Add new item</A>

Paste the HTML markup into the Content Editor web part.

You may need to wrap the above code in a div and additional styling to it as needed.

share|improve this answer
    
thanks for your valuable answer dhirschl –  Naresh Nemuri Dec 8 '11 at 6:04
    
but Mr.dhirschl,i wants the bottom link to be removed –  Naresh Nemuri Dec 8 '11 at 6:08
    
Change the toolbar type to No Toolbar in the XSLT List web part properties. –  NLV Dec 12 '11 at 13:52
add comment

Actually, the simplest approach and probably best solution is to simply link to the form on your site ending with NewForm.aspx. It looks even better if you add the + image in fron too. Example: New Issue Tracking Form

share|improve this answer
add comment

Assuming you have jQuery available in your environment. Here is a quick way to knock it out.

<script type="text/javascript" id="ms-addnew_js">
    $(document).ready(function () {
        $('.ms-addnew').filter(":last").hide();
    });
</script>
share|improve this answer
    
But the catch is that JQuery solutions always comes with a latency. You'll see the link for a minute. The best way is to edit the XSL underneath the List XSLT web part in the view page. –  NLV Dec 12 '11 at 13:52
add comment

This code must work with JQuery.

var $addnew = $('.ms-addnew');
($('#WebPartWPQ2').prepend('<br>')).prepend($addnew.html());
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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