Question: requestPager sorting using updateOrder #149

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

1 participant

@phillycoder

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

@phillycoder

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 join this conversation on GitHub. Already have an account? Sign in to comment