Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Order of rows and columns of grid type questions are wrong in preview. #63

Open
nishanc opened this issue Nov 29, 2018 · 1 comment
Open

Comments

@nishanc
Copy link

nishanc commented Nov 29, 2018

No description provided.

@nishanc
Copy link
Author

nishanc commented Dec 5, 2018

Issue resolved by implementing a method to sort.

            sortGrid(response.data.pages);

            function sortByOrderNo(array) {
                array.sort(function (a, b) {
                    return a.orderNo - b.orderNo;
                });
            }

            function sortGrid(arrayPages){
                for (let i = 0; i < arrayPages.length; i++) {
                    for (let j = 0; j < arrayPages[i].elements.length; j++) {
                        if (arrayPages[i].elements[j].question != null) {
                            if(arrayPages[i].elements[j].question.type === "grid"){
                                sortByOrderNo(arrayPages[i].elements[j].question.grid.cols);
                                sortByOrderNo(arrayPages[i].elements[j].question.grid.rows);
                            }
                        }
                    }
                }
            }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant