Quantcast
Channel: Microsoft Online: SharePoint Online forum
Viewing all articles
Browse latest Browse all 10096

how to sort SharePoint listview based on 3 columns?

$
0
0
I have a requirement to display items in sharepoint list in alphabetical order using 3 columns as first it should sort on column1 then column2 and then column3. In view settings i can sort only based on two columns, how can i display column3 in sort order. 

I have included 2 columns in view settings and I am trying to sort third column using CSR as below

SPClientTemplates.TemplateManager.RegisterTemplateOverrides({

View: function(ctx){
var rows = ctx.ListData.Row
console.log(rows);
var sortedRows =rows.sort(function (a, b) { //console.log(a);
return a.Title.toUpperCase() == b.Title.toUpperCase() ? 0 : a.Title.toUpperCase() < b.Title.toUpperCase() ? -1 : 1
});
ctx.ListData.Row=sortedRows;        
}
});


Please let me know where i am wrong.

Thanks in advance,
Nani

Viewing all articles
Browse latest Browse all 10096

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>