Skip to content
This repository has been archived by the owner on Jul 4, 2021. It is now read-only.

Question: requestPager sorting using updateOrder #149

Closed
phillycoder opened this issue Feb 24, 2013 · 1 comment
Closed

Question: requestPager sorting using updateOrder #149

phillycoder opened this issue Feb 24, 2013 · 1 comment

Comments

@phillycoder
Copy link
Contributor

Is there a way can i pass the direction(asc/desc) parameter in the updateOrder function?

@phillycoder
Copy link
Contributor Author

To make it work i did override the updateOrder method as follows.

           updateOrder: function ( column, direction ) {
                if (column !== undefined) {
                    this.sortField = column;
                    this.sortDirection = direction;

                    this.pager();
                }

            },

            server_api: {

                page: function(){
                    this.trigger('beforeLoad', this);

                    if(this.currentPage){
                        return this.currentPage;
                    } else {
                        return 1;
                    }
                },

                'orderby': function() {
                                if(this.sortField === undefined)
                                    return 'ReleaseYear';
                                return this.sortField;
                            },

                'orderdir': function() {
                                if(this.sortDirection === undefined)
                                    return 'asc';
                                return this.sortDirection;
                            },

                pageSize: function(){return this.perPage}
            },

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

No branches or pull requests

1 participant