Tuesday, 14 March 2017

Sort Data In Node.JS

I am using Node.JS and MongoDB. I've created a report with CSV file and this is my code,

function buildListCsvContent() {
            var array = [];
            var counter = 0;
            for (var i = 0; i < vm.student.length; i++) {
                    var row = {
                        No: counter + 1
                        , Registration_Number: "'" + student.registrationNumber.toString()
                        , Name: student.firstName + ' ' + student.lastName
                    }
                    array.push(row);
                    counter++
                }
            }


            var args = {
                data: array
            };

            downloadCSV(args);
        }

How can i sort this report by registrationNumber?



via Yosapat Tambunan

No comments:

Post a Comment