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

We are trying to do in this library, is create a column that will provide the “order” number of the listed item, per view.

So in one view there may be five items that show and they need to be numbered 1 through 5. Then in another view there may be 15 items that show and in this case they would need to display the numbering 1 through 15.

We have 12 views in total that would need the dynamic order numbering.

Please advise.

We are not able to use Visual Studio to work on this, only SharePoint Designer.

share|improve this question

2 Answers 2

You can use SPD. On a page add the list view, then create a column and insert the following code:

<xsl:value-of select="count($thisNode/../*[not($thisNode/@ID=preceding-sibling::*/@ID)])" />

It should render the row number, no matter if you change the view order or filter some information.

Sample list

Hope this helps

share|improve this answer

I have a list MyTestList. It has currently two views TestView1 and TestView2. To add serial number in the front follow the following steps:

  1. Open the site in SPD
  2. Open the List enter image description here

  3. Edit the view in Split mode enter image description here enter image description here

  4. Select the List, Go to 'List View Tools' in the Ribbon > 'Design' > 'Customize XSLT' > 'Customize Entire View'
  5. This will convert the view in detail xslt
  6. Now click on the attachment column. Right Click > Insert > Column To The Left enter image description here
  7. Save the Page
  8. Come to the Browser, Go to the List and Go to the View
  9. Edit the Page of the View enter image description here
  10. Add a Content Editor WebPart in the Page. enter image description here
  11. Change the Content Editor Webpart's Chorme Type to 'None'. So web part's tool should not be shown in the page. enter image description here
  12. Click the Content Editor WebPart and go the HTML and paste the following lines showing in the Image to refer the Script.js and jquery-1.11.1.min.js. This will refer the Script, which will show the serial number enter image description here

  13. Go to the 'Site Assets' and upload jquery-1.11.1.min.js and Script.js which will contain the following code:

$(document).ready(function () {
    var count=0;
    $('.ms-listviewtable tr td:nth-child(2)').each(function( index ) {
                count++;
                $(this).text(count);
            });
});

Above steps needs to be repeated in all the views you have. Best of luck.

share|improve this answer

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.