I am trying to create a document library, which has a default view of the most recently published major version. If anyone checks-out a document to create a draft, I want other editors to be able to still see the publish

I tried to implement flayman's solution here: Document Library-Major and Minor Views

<script type="text/javascript">
(function() {
    ListTemplateType: 101,
    Templates: {
        OnPreRender: function(ctx) {
            for (var i = ctx.ListData.Row.length - 1; i > -1; i--) {
                var row = ctx.ListData.Row[i];
                var versionString = row._UIVersionString;
                var versionFloat = parseFloat(versionString);
                if (versionFloat < 1.0) {
                    // this removes any rows that have had no published version yet
                    ctx.ListData.Row.splice(i, 1);

                var versionInt = parseInt(versionFloat);
                versionString = versionInt + '.0';
                // The link doesn't work if there are no minor versions beyond this
                if (versionString == row._UIVersionString) continue;

                var versionBin = versionInt * 512;
                row._UIVersionString = versionString;
                row.FileRef = '/_vti_history/' + versionBin + row.FileRef;

Problem is that the reference document link will go to the most recent version e.g. 1.1 not the most recent published version e.g. 1.0. Anyone have ideas?

  • In your opinion, what's the diff between the most recent version and the most recent published version? – Mohamed El-Qassas MVP Sep 5 '17 at 23:30
  • The most recent published version has been approved by an approver, while the most recent version has been edited, but not yet approved. I want editors to be able to see the approved published version as default, but also be able to view any current drafts if necessary. – J.Choe Sep 5 '17 at 23:35

Your Answer

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

Browse other questions tagged or ask your own question.